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 2019/06/10 22:10:50 UTC

[incubator-datasketches-cpp] branch theta created (now 693aec6)

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

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


      at 693aec6  remove duplication

This branch includes the following new commits:

     new 693aec6  remove duplication

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-datasketches-cpp] 01/01: remove duplication

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 693aec691fb7f9a1740c1e08a93182cbb65e23c3
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Mon Jun 10 15:10:42 2019 -0700

    remove duplication
---
 theta/include/theta_a_not_b_impl.hpp      | 10 ----------
 theta/include/theta_intersection_impl.hpp | 10 ----------
 theta/include/theta_sketch.hpp            | 12 ++++++++++++
 3 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/theta/include/theta_a_not_b_impl.hpp b/theta/include/theta_a_not_b_impl.hpp
index a794b63..1882b01 100644
--- a/theta/include/theta_a_not_b_impl.hpp
+++ b/theta/include/theta_a_not_b_impl.hpp
@@ -21,16 +21,6 @@ theta_a_not_b_alloc<A>::theta_a_not_b_alloc(uint64_t seed):
 seed_hash_(theta_sketch_alloc<A>::get_seed_hash(seed))
 {}
 
-constexpr uint8_t log2(uint32_t n) {
-  return (n > 1) ? 1 + log2(n >> 1) : 0;
-}
-
-constexpr uint8_t lg_size_from_count(uint32_t n, double load_factor) {
-  uint8_t lg = log2(n) + 1;
-  if (n > (1 << lg) * load_factor) lg++;
-  return lg;
-}
-
 template<typename A>
 compact_theta_sketch_alloc<A> theta_a_not_b_alloc<A>::compute(const theta_sketch_alloc<A>& a, const theta_sketch_alloc<A>& b, bool ordered) const {
   if (a.is_empty()) return compact_theta_sketch_alloc<A>(a, ordered);
diff --git a/theta/include/theta_intersection_impl.hpp b/theta/include/theta_intersection_impl.hpp
index 9174e65..7f26d0c 100644
--- a/theta/include/theta_intersection_impl.hpp
+++ b/theta/include/theta_intersection_impl.hpp
@@ -89,16 +89,6 @@ theta_intersection_alloc<A>& theta_intersection_alloc<A>::operator=(theta_inters
   return *this;
 }
 
-constexpr uint8_t log2(uint32_t n) {
-  return (n > 1) ? 1 + log2(n >> 1) : 0;
-}
-
-constexpr uint8_t lg_size_from_count(uint32_t n, double load_factor) {
-  uint8_t lg = log2(n) + 1;
-  if (n > (1 << lg) * load_factor) lg++;
-  return lg;
-}
-
 template<typename A>
 void theta_intersection_alloc<A>::update(const theta_sketch_alloc<A>& sketch) {
   if (is_empty_) return;
diff --git a/theta/include/theta_sketch.hpp b/theta/include/theta_sketch.hpp
index 3eab496..acb4374 100644
--- a/theta/include/theta_sketch.hpp
+++ b/theta/include/theta_sketch.hpp
@@ -274,6 +274,18 @@ typedef theta_sketch_alloc<std::allocator<void>> theta_sketch;
 typedef update_theta_sketch_alloc<std::allocator<void>> update_theta_sketch;
 typedef compact_theta_sketch_alloc<std::allocator<void>> compact_theta_sketch;
 
+// common helping functions
+
+constexpr uint8_t log2(uint32_t n) {
+  return (n > 1) ? 1 + log2(n >> 1) : 0;
+}
+
+constexpr uint8_t lg_size_from_count(uint32_t n, double load_factor) {
+  uint8_t lg = log2(n) + 1;
+  if (n > (1 << lg) * load_factor) lg++;
+  return lg;
+}
+
 } /* namespace datasketches */
 
 #include "theta_sketch_impl.hpp"


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