You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2022/07/12 17:20:25 UTC

[datasketches-cpp] branch master updated: fix comparison bug since type uint8_t is always non-negative

This is an automated email from the ASF dual-hosted git repository.

alsay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 3633c6e  fix comparison bug since type uint8_t is always non-negative
     new d1ec6c8  Merge pull request #291 from dyf6372/master
3633c6e is described below

commit 3633c6e84cf86df18475a03fe4687ed153c3b4d4
Author: dongyifeng <do...@bytedance.com>
AuthorDate: Thu Jul 7 23:59:34 2022 +0800

    fix comparison bug since type uint8_t is always non-negative
---
 hll/include/Hll4Array-internal.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hll/include/Hll4Array-internal.hpp b/hll/include/Hll4Array-internal.hpp
index b0e09a7..e8ace21 100644
--- a/hll/include/Hll4Array-internal.hpp
+++ b/hll/include/Hll4Array-internal.hpp
@@ -267,10 +267,10 @@ void Hll4Array<A>::shiftToBiggerCurMin() {
     for (const auto coupon: *auxHashMap_) {
       slotNum = HllUtil<A>::getLow26(coupon) & configKmask;
       oldActualVal = HllUtil<A>::getValue(coupon);
-      newShiftedVal = oldActualVal - newCurMin;
-      if (newShiftedVal < 0) {
+      if (oldActualVal < newCurMin) {
         throw std::logic_error("oldActualVal < newCurMin when incrementing curMin");
       }
+      newShiftedVal = oldActualVal - newCurMin;
 
       if (getSlot(slotNum) != hll_constants::AUX_TOKEN) {
         throw std::logic_error("getSlot(slotNum) != AUX_TOKEN for item in auxiliary hash map");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org