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

jmalkin 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 077cc93  is CouponHashSet deserialization incorrect?
     new c3784a5  Merge pull request #266 from etseidl/patch-1
077cc93 is described below

commit 077cc93834ff14ebe93738c92073dd1f4f615b2a
Author: etseidl <[email protected]>
AuthorDate: Wed Mar 9 08:46:56 2022 -0800

    is CouponHashSet deserialization incorrect?
    
    When deserializing an updatable CouponHashSet from a byte array, wouldn't 
you need to copy the entire coupons array rather than just using couponCount 
since the hash array is not populated sequentially like the CouponList?
---
 hll/include/CouponHashSet-internal.hpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hll/include/CouponHashSet-internal.hpp 
b/hll/include/CouponHashSet-internal.hpp
index b8093ad..7474cf2 100644
--- a/hll/include/CouponHashSet-internal.hpp
+++ b/hll/include/CouponHashSet-internal.hpp
@@ -114,10 +114,9 @@ CouponHashSet<A>* CouponHashSet<A>::newSet(const void* 
bytes, size_t len, const
   } else {
     sketch->coupons_.resize(1ULL << lgArrInts);
     sketch->couponCount_ = couponCount;
-    // only need to read valid coupons, unlike in stream case
     std::memcpy(sketch->coupons_.data(),
                 data + hll_constants::HASH_SET_INT_ARR_START,
-                couponCount * sizeof(uint32_t));
+                couponsInArray * sizeof(uint32_t));
   }
 
   return sketch;

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to