@@ -85,7 +85,6 @@ class hyperloglog_impl {
8585 precision_{cuda::std::countr_zero (
8686 sketch_bytes (cuco::sketch_size_kb (static_cast <double >(sketch_span.size () / 1024.0 ))) /
8787 sizeof (register_type))},
88- register_mask_{(1ull << this ->precision_ ) - 1 },
8988 sketch_{reinterpret_cast <register_type*>(sketch_span.data ()),
9089 this ->sketch_bytes () / sizeof (register_type)}
9190 {
@@ -150,8 +149,8 @@ class hyperloglog_impl {
150149 __device__ constexpr void add (T const & item) noexcept
151150 {
152151 auto const h = this ->hash_ (item);
153- auto const reg = h & this ->register_mask_ ;
154- auto const zeroes = cuda::std::countl_zero (h | this ->register_mask_ ) + 1 ; // __clz
152+ auto const reg = h & this ->register_mask () ;
153+ auto const zeroes = cuda::std::countl_zero (h | this ->register_mask () ) + 1 ; // __clz
155154
156155 // reversed order (same one as Spark uses)
157156 // auto const reg = h >> ((sizeof(hash_value_type) * 8) - this->precision_);
@@ -572,9 +571,18 @@ class hyperloglog_impl {
572571 }
573572 }
574573
574+ /* *
575+ * @brief Gets the register mask used to separate register index from count.
576+ *
577+ * @return The register mask
578+ */
579+ __host__ __device__ constexpr hash_value_type register_mask () const noexcept
580+ {
581+ return (1ull << this ->precision_ ) - 1 ;
582+ }
583+
575584 hasher hash_; // /< Hash function used to hash items
576585 int32_t precision_; // /< HLL precision parameter
577- hash_value_type register_mask_; // /< Mask used to separate register index from count
578586 cuda::std::span<register_type> sketch_; // /< HLL sketch storage
579587
580588 template <class T_ , cuda::thread_scope Scope_, class Hash_ >
0 commit comments