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

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

commit ea076f453d36c32d64768043b47db5d49f51ebc3
Author: AlexanderSaydakov <[email protected]>
AuthorDate: Tue Oct 17 14:19:33 2023 -0700

    fix issue #395
---
 theta/include/theta_intersection_base_impl.hpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/theta/include/theta_intersection_base_impl.hpp 
b/theta/include/theta_intersection_base_impl.hpp
index ede9c29..1adb40e 100644
--- a/theta/include/theta_intersection_base_impl.hpp
+++ b/theta/include/theta_intersection_base_impl.hpp
@@ -49,7 +49,7 @@ void theta_intersection_base<EN, EK, P, S, CS, 
A>::update(SS&& sketch) {
   if (!is_valid_) { // first update, copy or move incoming sketch
     is_valid_ = true;
     const uint8_t lg_size = lg_size_from_count(sketch.get_num_retained(), 
theta_update_sketch_base<EN, EK, A>::REBUILD_THRESHOLD);
-    table_ = hash_table(lg_size, lg_size, resize_factor::X1, 1, table_.theta_, 
table_.seed_, table_.allocator_, table_.is_empty_);
+    table_ = hash_table(lg_size, lg_size - 1, resize_factor::X1, 1, 
table_.theta_, table_.seed_, table_.allocator_, table_.is_empty_);
     for (auto&& entry: sketch) {
       auto result = table_.find(EK()(entry));
       if (result.second) {
@@ -88,8 +88,8 @@ void theta_intersection_base<EN, EK, P, S, CS, 
A>::update(SS&& sketch) {
       if (table_.theta_ == theta_constants::MAX_THETA) table_.is_empty_ = true;
     } else {
       const uint8_t lg_size = lg_size_from_count(match_count, 
theta_update_sketch_base<EN, EK, A>::REBUILD_THRESHOLD);
-      table_ = hash_table(lg_size, lg_size, resize_factor::X1, 1, 
table_.theta_, table_.seed_, table_.allocator_, table_.is_empty_);
-      for (uint32_t i = 0; i < match_count; i++) {
+      table_ = hash_table(lg_size, lg_size - 1, resize_factor::X1, 1, 
table_.theta_, table_.seed_, table_.allocator_, table_.is_empty_);
+      for (uint32_t i = 0; i < match_count; ++i) {
         auto result = table_.find(EK()(matched_entries[i]));
         table_.insert(result.first, std::move(matched_entries[i]));
       }


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

Reply via email to