Merge pull request #29758 from seanm:Wfloat-conversion

Fixed Clang -Wfloat-conversion warning in public header
This commit is contained in:
Alexander Smorkalov
2026-08-25 14:05:41 +03:00
committed by GitHub
3 changed files with 5 additions and 5 deletions

View File

@@ -230,7 +230,7 @@ public:
private:
/** Defines the comparator on score and index
*/
typedef std::pair<float, unsigned int> ScoreIndexPair;
typedef std::pair<DistanceType, unsigned int> ScoreIndexPair;
struct SortScoreIndexPairOnSecond
{
bool operator()(const ScoreIndexPair& left, const ScoreIndexPair& right) const
@@ -271,7 +271,7 @@ private:
static std::vector<ScoreIndexPair> score_index_heap;
if (do_k) {
unsigned int worst_score = std::numeric_limits<unsigned int>::max();
DistanceType worst_score = std::numeric_limits<DistanceType>::max();
typename std::vector<lsh::LshTable<ElementType> >::const_iterator table = tables_.begin();
typename std::vector<lsh::LshTable<ElementType> >::const_iterator table_end = tables_.end();
for (; table != table_end; ++table) {

View File

@@ -38,6 +38,7 @@
//! @cond IGNORED
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <limits.h>
@@ -52,7 +53,6 @@
#else
#include <map>
#endif
#include <math.h>
#include <stddef.h>
#include "dynamic_bitset.h"
@@ -205,7 +205,7 @@ public:
void add(Matrix<ElementType> dataset)
{
#if USE_UNORDERED_MAP
buckets_space_.rehash((buckets_space_.size() + dataset.rows) * 1.2);
buckets_space_.rehash(std::llround((buckets_space_.size() + dataset.rows) * 1.2));
#endif
// Add the features to the table
for (unsigned int i = 0; i < dataset.rows; ++i) add(i, dataset[i]);

View File

@@ -332,7 +332,7 @@ inline float calcSubpixel(const float &x_l,const float &x,const float &x_r)
const float l1 = float(std::log(x+1e-6));
const float l2 = float(std::log(x_r+1e-6));
float delta = l2-l1-l1+l0;
if(!delta) // this happens if all values are identical
if(delta == 0.0f) // this happens if all values are identical
return 0;
delta = (l0-l2)/(delta+delta);
return delta;