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 2021/11/02 21:21:47 UTC
[datasketches-cpp] branch theta_reset updated: simplified slightly
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch theta_reset
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
The following commit(s) were added to refs/heads/theta_reset by this push:
new a2a238b simplified slightly
a2a238b is described below
commit a2a238b96a5c9f64d54c7794f8afd8e7920d240f
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Tue Nov 2 14:21:38 2021 -0700
simplified slightly
---
theta/include/theta_update_sketch_base_impl.hpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/theta/include/theta_update_sketch_base_impl.hpp b/theta/include/theta_update_sketch_base_impl.hpp
index f8c7998..bf365c8 100644
--- a/theta/include/theta_update_sketch_base_impl.hpp
+++ b/theta/include/theta_update_sketch_base_impl.hpp
@@ -258,7 +258,10 @@ template<typename EN, typename EK, typename A>
void theta_update_sketch_base<EN, EK, A>::reset() {
const size_t cur_size = 1ULL << lg_cur_size_;
for (size_t i = 0; i < cur_size; ++i) {
- if (EK()(entries_[i]) != 0) entries_[i].~EN();
+ if (EK()(entries_[i]) != 0) {
+ entries_[i].~EN();
+ EK()(entries_[i]) = 0;
+ }
}
const uint8_t starting_lg_size = theta_build_helper<true>::starting_sub_multiple(
lg_nom_size_ + 1, theta_constants::MIN_LG_K, static_cast<uint8_t>(rf_));
@@ -268,8 +271,6 @@ void theta_update_sketch_base<EN, EK, A>::reset() {
const size_t new_size = 1ULL << starting_lg_size;
entries_ = allocator_.allocate(new_size);
for (size_t i = 0; i < new_size; ++i) EK()(entries_[i]) = 0;
- } else {
- for (size_t i = 0; i < cur_size; ++i) EK()(entries_[i]) = 0;
}
num_entries_ = 0;
theta_ = theta_build_helper<true>::starting_theta_from_p(p_);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org