summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorLester Solbakken <lesters@yahoo-inc.com>2017-08-18 12:51:25 +0000
committerLester Solbakken <lesters@yahoo-inc.com>2017-08-18 12:51:25 +0000
commit256703c082d879f54a3f20e9393320fdb662f996 (patch)
treeba8e7af76c3460531beea6de44153e8fa6c2ef9a /searchlib
parent5e389abbfb5906b91f742235685fe96e0f0b4de5 (diff)
Make maxProduct more modern
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp
index 0c03a36a211..57283b29277 100644
--- a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp
@@ -50,15 +50,17 @@ RawExecutor<BaseType>::RawExecutor(const IAttributeVector *attribute,
template <typename A, typename V>
feature_t maxProduct(const A& array, size_t count, const V& query)
{
- feature_t val = -DBL_MAX;
+ feature_t val = -std::numeric_limits<double>::max();
for (size_t i = 0; i < count; ++i) {
- typename IntegerVector::HashMap::const_iterator itr = query.getDimMap().find(array[i].value());
+ auto itr = query.getDimMap().find(array[i].value());
if (itr != query.getDimMap().end()) {
feature_t v = itr->second; // weight from attribute is assumed to be 1.0
- if (v > val) val = v;
+ if (v > val) {
+ val = v;
+ }
}
}
- return val == -DBL_MAX ? 0.0 : val;
+ return val == -std::numeric_limits<double>::max() ? 0.0 : val;
}
template <typename BaseType>