datasketches 0.2.0 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/LICENSE +40 -3
  4. data/NOTICE +1 -1
  5. data/README.md +7 -7
  6. data/ext/datasketches/extconf.rb +1 -1
  7. data/ext/datasketches/theta_wrapper.cpp +20 -4
  8. data/lib/datasketches/version.rb +1 -1
  9. data/vendor/datasketches-cpp/CMakeLists.txt +31 -3
  10. data/vendor/datasketches-cpp/LICENSE +40 -3
  11. data/vendor/datasketches-cpp/MANIFEST.in +3 -0
  12. data/vendor/datasketches-cpp/NOTICE +1 -1
  13. data/vendor/datasketches-cpp/README.md +76 -9
  14. data/vendor/datasketches-cpp/cmake/DataSketchesConfig.cmake.in +10 -0
  15. data/vendor/datasketches-cpp/common/CMakeLists.txt +14 -13
  16. data/vendor/datasketches-cpp/common/include/MurmurHash3.h +11 -7
  17. data/vendor/datasketches-cpp/common/include/binomial_bounds.hpp +8 -8
  18. data/vendor/datasketches-cpp/common/include/bounds_binomial_proportions.hpp +12 -15
  19. data/vendor/datasketches-cpp/common/include/common_defs.hpp +26 -0
  20. data/vendor/datasketches-cpp/common/include/conditional_forward.hpp +20 -8
  21. data/vendor/datasketches-cpp/common/include/count_zeros.hpp +2 -2
  22. data/vendor/datasketches-cpp/common/include/serde.hpp +7 -7
  23. data/vendor/datasketches-cpp/cpc/CMakeLists.txt +15 -35
  24. data/vendor/datasketches-cpp/cpc/include/cpc_common.hpp +10 -3
  25. data/vendor/datasketches-cpp/cpc/include/cpc_compressor.hpp +19 -19
  26. data/vendor/datasketches-cpp/cpc/include/cpc_compressor_impl.hpp +91 -89
  27. data/vendor/datasketches-cpp/cpc/include/cpc_sketch.hpp +15 -2
  28. data/vendor/datasketches-cpp/cpc/include/cpc_sketch_impl.hpp +126 -90
  29. data/vendor/datasketches-cpp/cpc/include/cpc_union.hpp +1 -1
  30. data/vendor/datasketches-cpp/cpc/include/cpc_union_impl.hpp +22 -20
  31. data/vendor/datasketches-cpp/cpc/include/cpc_util.hpp +10 -10
  32. data/vendor/datasketches-cpp/cpc/include/icon_estimator.hpp +4 -4
  33. data/vendor/datasketches-cpp/cpc/include/u32_table.hpp +8 -8
  34. data/vendor/datasketches-cpp/cpc/include/u32_table_impl.hpp +14 -14
  35. data/vendor/datasketches-cpp/cpc/test/compression_test.cpp +10 -10
  36. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_allocation_test.cpp +17 -0
  37. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +25 -0
  38. data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +1 -1
  39. data/vendor/datasketches-cpp/fi/CMakeLists.txt +5 -15
  40. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch_impl.hpp +69 -82
  41. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map_impl.hpp +10 -10
  42. data/vendor/datasketches-cpp/fi/test/reverse_purge_hash_map_test.cpp +2 -2
  43. data/vendor/datasketches-cpp/hll/CMakeLists.txt +33 -56
  44. data/vendor/datasketches-cpp/hll/include/AuxHashMap-internal.hpp +60 -63
  45. data/vendor/datasketches-cpp/hll/include/AuxHashMap.hpp +19 -19
  46. data/vendor/datasketches-cpp/hll/include/CompositeInterpolationXTable-internal.hpp +15 -15
  47. data/vendor/datasketches-cpp/hll/include/CompositeInterpolationXTable.hpp +3 -3
  48. data/vendor/datasketches-cpp/hll/include/CouponHashSet-internal.hpp +74 -76
  49. data/vendor/datasketches-cpp/hll/include/CouponHashSet.hpp +6 -6
  50. data/vendor/datasketches-cpp/hll/include/CouponList-internal.hpp +110 -113
  51. data/vendor/datasketches-cpp/hll/include/CouponList.hpp +13 -13
  52. data/vendor/datasketches-cpp/hll/include/CubicInterpolation-internal.hpp +2 -4
  53. data/vendor/datasketches-cpp/hll/include/HarmonicNumbers-internal.hpp +1 -1
  54. data/vendor/datasketches-cpp/hll/include/Hll4Array-internal.hpp +80 -76
  55. data/vendor/datasketches-cpp/hll/include/Hll4Array.hpp +9 -9
  56. data/vendor/datasketches-cpp/hll/include/Hll6Array-internal.hpp +26 -26
  57. data/vendor/datasketches-cpp/hll/include/Hll6Array.hpp +6 -6
  58. data/vendor/datasketches-cpp/hll/include/Hll8Array-internal.hpp +33 -33
  59. data/vendor/datasketches-cpp/hll/include/Hll8Array.hpp +6 -6
  60. data/vendor/datasketches-cpp/hll/include/HllArray-internal.hpp +205 -209
  61. data/vendor/datasketches-cpp/hll/include/HllArray.hpp +36 -36
  62. data/vendor/datasketches-cpp/hll/include/HllSketch-internal.hpp +34 -32
  63. data/vendor/datasketches-cpp/hll/include/HllSketchImpl-internal.hpp +22 -22
  64. data/vendor/datasketches-cpp/hll/include/HllSketchImpl.hpp +13 -13
  65. data/vendor/datasketches-cpp/hll/include/HllSketchImplFactory.hpp +15 -15
  66. data/vendor/datasketches-cpp/hll/include/HllUnion-internal.hpp +61 -61
  67. data/vendor/datasketches-cpp/hll/include/HllUtil.hpp +120 -127
  68. data/vendor/datasketches-cpp/hll/include/coupon_iterator-internal.hpp +9 -9
  69. data/vendor/datasketches-cpp/hll/include/coupon_iterator.hpp +5 -5
  70. data/vendor/datasketches-cpp/hll/include/hll.hpp +21 -21
  71. data/vendor/datasketches-cpp/hll/test/AuxHashMapTest.cpp +1 -1
  72. data/vendor/datasketches-cpp/hll/test/CouponHashSetTest.cpp +34 -34
  73. data/vendor/datasketches-cpp/hll/test/CouponListTest.cpp +25 -25
  74. data/vendor/datasketches-cpp/hll/test/CrossCountingTest.cpp +2 -2
  75. data/vendor/datasketches-cpp/hll/test/HllArrayTest.cpp +35 -35
  76. data/vendor/datasketches-cpp/hll/test/HllSketchTest.cpp +15 -15
  77. data/vendor/datasketches-cpp/hll/test/HllUnionTest.cpp +10 -14
  78. data/vendor/datasketches-cpp/hll/test/IsomorphicTest.cpp +3 -3
  79. data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +4 -4
  80. data/vendor/datasketches-cpp/kll/CMakeLists.txt +9 -19
  81. data/vendor/datasketches-cpp/kll/include/kll_helper.hpp +5 -4
  82. data/vendor/datasketches-cpp/kll/include/kll_helper_impl.hpp +6 -6
  83. data/vendor/datasketches-cpp/kll/include/kll_quantile_calculator.hpp +14 -6
  84. data/vendor/datasketches-cpp/kll/include/kll_quantile_calculator_impl.hpp +39 -24
  85. data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +41 -4
  86. data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +76 -64
  87. data/vendor/datasketches-cpp/kll/include/kolmogorov_smirnov.hpp +67 -0
  88. data/vendor/datasketches-cpp/kll/include/kolmogorov_smirnov_impl.hpp +78 -0
  89. data/vendor/datasketches-cpp/kll/test/CMakeLists.txt +1 -0
  90. data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +133 -46
  91. data/vendor/datasketches-cpp/kll/test/kolmogorov_smirnov_test.cpp +111 -0
  92. data/vendor/datasketches-cpp/pyproject.toml +4 -2
  93. data/vendor/datasketches-cpp/python/CMakeLists.txt +10 -6
  94. data/vendor/datasketches-cpp/python/README.md +50 -50
  95. data/vendor/datasketches-cpp/python/pybind11Path.cmd +3 -0
  96. data/vendor/datasketches-cpp/python/src/cpc_wrapper.cpp +1 -1
  97. data/vendor/datasketches-cpp/python/src/hll_wrapper.cpp +4 -4
  98. data/vendor/datasketches-cpp/python/src/kll_wrapper.cpp +1 -1
  99. data/vendor/datasketches-cpp/python/src/theta_wrapper.cpp +8 -8
  100. data/vendor/datasketches-cpp/python/src/vector_of_kll.cpp +11 -5
  101. data/vendor/datasketches-cpp/python/src/vo_wrapper.cpp +2 -2
  102. data/vendor/datasketches-cpp/python/tests/hll_test.py +1 -1
  103. data/vendor/datasketches-cpp/python/tests/kll_test.py +2 -2
  104. data/vendor/datasketches-cpp/python/tests/req_test.py +2 -2
  105. data/vendor/datasketches-cpp/python/tests/vector_of_kll_test.py +4 -4
  106. data/vendor/datasketches-cpp/python/tests/vo_test.py +3 -3
  107. data/vendor/datasketches-cpp/req/CMakeLists.txt +8 -21
  108. data/vendor/datasketches-cpp/req/include/req_common.hpp +2 -1
  109. data/vendor/datasketches-cpp/req/include/req_compactor.hpp +4 -4
  110. data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +26 -39
  111. data/vendor/datasketches-cpp/req/include/req_sketch.hpp +1 -1
  112. data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +13 -11
  113. data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +52 -52
  114. data/vendor/datasketches-cpp/sampling/CMakeLists.txt +5 -9
  115. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch.hpp +10 -5
  116. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch_impl.hpp +61 -64
  117. data/vendor/datasketches-cpp/sampling/include/var_opt_union_impl.hpp +42 -48
  118. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +6 -6
  119. data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +13 -13
  120. data/vendor/datasketches-cpp/setup.py +10 -7
  121. data/vendor/datasketches-cpp/theta/CMakeLists.txt +26 -45
  122. data/vendor/datasketches-cpp/theta/include/bounds_on_ratios_in_sampled_sets.hpp +1 -1
  123. data/vendor/datasketches-cpp/theta/include/compact_theta_sketch_parser.hpp +67 -0
  124. data/vendor/datasketches-cpp/theta/include/compact_theta_sketch_parser_impl.hpp +137 -0
  125. data/vendor/datasketches-cpp/theta/include/theta_constants.hpp +9 -4
  126. data/vendor/datasketches-cpp/theta/include/theta_helpers.hpp +15 -0
  127. data/vendor/datasketches-cpp/theta/include/theta_intersection.hpp +9 -4
  128. data/vendor/datasketches-cpp/theta/include/theta_intersection_base_impl.hpp +6 -6
  129. data/vendor/datasketches-cpp/theta/include/theta_intersection_impl.hpp +1 -1
  130. data/vendor/datasketches-cpp/theta/include/theta_jaccard_similarity_base.hpp +18 -14
  131. data/vendor/datasketches-cpp/theta/include/theta_set_difference_base_impl.hpp +2 -2
  132. data/vendor/datasketches-cpp/theta/include/theta_sketch.hpp +73 -15
  133. data/vendor/datasketches-cpp/theta/include/theta_sketch_impl.hpp +247 -103
  134. data/vendor/datasketches-cpp/theta/include/theta_union.hpp +10 -5
  135. data/vendor/datasketches-cpp/theta/include/theta_union_base.hpp +3 -1
  136. data/vendor/datasketches-cpp/theta/include/theta_union_base_impl.hpp +9 -3
  137. data/vendor/datasketches-cpp/theta/include/theta_union_impl.hpp +8 -5
  138. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base.hpp +11 -5
  139. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base_impl.hpp +70 -37
  140. data/vendor/datasketches-cpp/theta/test/CMakeLists.txt +1 -0
  141. data/vendor/datasketches-cpp/theta/test/theta_a_not_b_test.cpp +23 -1
  142. data/vendor/datasketches-cpp/theta/test/theta_compact_empty_from_java_v1.sk +0 -0
  143. data/vendor/datasketches-cpp/theta/test/theta_compact_empty_from_java_v2.sk +0 -0
  144. data/vendor/datasketches-cpp/theta/test/theta_compact_estimation_from_java_v1.sk +0 -0
  145. data/vendor/datasketches-cpp/theta/test/theta_compact_estimation_from_java_v2.sk +0 -0
  146. data/vendor/datasketches-cpp/theta/test/theta_compact_exact_from_java.sk +0 -0
  147. data/vendor/datasketches-cpp/theta/test/theta_intersection_test.cpp +21 -1
  148. data/vendor/datasketches-cpp/theta/test/theta_jaccard_similarity_test.cpp +58 -2
  149. data/vendor/datasketches-cpp/theta/test/theta_setop_test.cpp +445 -0
  150. data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +437 -1
  151. data/vendor/datasketches-cpp/theta/test/theta_union_test.cpp +41 -9
  152. data/vendor/datasketches-cpp/tuple/CMakeLists.txt +18 -33
  153. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_sketch.hpp +1 -1
  154. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_sketch_impl.hpp +50 -63
  155. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_union.hpp +1 -1
  156. data/vendor/datasketches-cpp/tuple/include/array_of_doubles_union_impl.hpp +3 -3
  157. data/vendor/datasketches-cpp/tuple/include/tuple_sketch.hpp +13 -9
  158. data/vendor/datasketches-cpp/tuple/include/tuple_sketch_impl.hpp +84 -78
  159. data/vendor/datasketches-cpp/tuple/include/tuple_union.hpp +6 -1
  160. data/vendor/datasketches-cpp/tuple/include/tuple_union_impl.hpp +8 -3
  161. data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +17 -1
  162. data/vendor/datasketches-cpp/tuple/test/tuple_a_not_b_test.cpp +17 -17
  163. data/vendor/datasketches-cpp/tuple/test/tuple_intersection_test.cpp +12 -12
  164. data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +5 -5
  165. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_allocation_test.cpp +1 -1
  166. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +66 -28
  167. data/vendor/datasketches-cpp/tuple/test/tuple_union_test.cpp +19 -12
  168. metadata +18 -7
  169. data/vendor/datasketches-cpp/theta/test/theta_update_empty_from_java.sk +0 -0
  170. data/vendor/datasketches-cpp/theta/test/theta_update_estimation_from_java.sk +0 -0
@@ -31,7 +31,7 @@ class AuxHashMap;
31
31
  template<typename A>
32
32
  class HllArray : public HllSketchImpl<A> {
33
33
  public:
34
- HllArray(int lgConfigK, target_hll_type tgtHllType, bool startFullSize, const A& allocator);
34
+ HllArray(uint8_t lgConfigK, target_hll_type tgtHllType, bool startFullSize, const A& allocator);
35
35
 
36
36
  static HllArray* newHll(const void* bytes, size_t len, const A& allocator);
37
37
  static HllArray* newHll(std::istream& is, const A& allocator);
@@ -45,25 +45,25 @@ class HllArray : public HllSketchImpl<A> {
45
45
  virtual HllArray* copy() const = 0;
46
46
  virtual HllArray* copyAs(target_hll_type tgtHllType) const;
47
47
 
48
- virtual HllSketchImpl<A>* couponUpdate(int coupon) = 0;
48
+ virtual HllSketchImpl<A>* couponUpdate(uint32_t coupon) = 0;
49
49
 
50
50
  virtual double getEstimate() const;
51
51
  virtual double getCompositeEstimate() const;
52
- virtual double getLowerBound(int numStdDev) const;
53
- virtual double getUpperBound(int numStdDev) const;
52
+ virtual double getLowerBound(uint8_t numStdDev) const;
53
+ virtual double getUpperBound(uint8_t numStdDev) const;
54
54
 
55
55
  inline void addToHipAccum(double delta);
56
56
 
57
57
  inline void decNumAtCurMin();
58
58
 
59
- inline int getCurMin() const;
60
- inline int getNumAtCurMin() const;
59
+ inline uint8_t getCurMin() const;
60
+ inline uint32_t getNumAtCurMin() const;
61
61
  inline double getHipAccum() const;
62
62
 
63
- virtual int getHllByteArrBytes() const = 0;
63
+ virtual uint32_t getHllByteArrBytes() const = 0;
64
64
 
65
- virtual int getUpdatableSerializationBytes() const;
66
- virtual int getCompactSerializationBytes() const;
65
+ virtual uint32_t getUpdatableSerializationBytes() const;
66
+ virtual uint32_t getCompactSerializationBytes() const;
67
67
 
68
68
  virtual bool isOutOfOrderFlag() const;
69
69
  virtual bool isEmpty() const;
@@ -74,19 +74,19 @@ class HllArray : public HllSketchImpl<A> {
74
74
  inline double getKxQ0() const;
75
75
  inline double getKxQ1() const;
76
76
 
77
- virtual int getMemDataStart() const;
78
- virtual int getPreInts() const;
77
+ virtual uint32_t getMemDataStart() const;
78
+ virtual uint8_t getPreInts() const;
79
79
 
80
- void putCurMin(int curMin);
80
+ void putCurMin(uint8_t curMin);
81
81
  void putHipAccum(double hipAccum);
82
82
  inline void putKxQ0(double kxq0);
83
83
  inline void putKxQ1(double kxq1);
84
- void putNumAtCurMin(int numAtCurMin);
84
+ void putNumAtCurMin(uint32_t numAtCurMin);
85
85
 
86
- static int hllArrBytes(target_hll_type tgtHllType, int lgConfigK);
87
- static int hll4ArrBytes(int lgConfigK);
88
- static int hll6ArrBytes(int lgConfigK);
89
- static int hll8ArrBytes(int lgConfigK);
86
+ static uint32_t hllArrBytes(target_hll_type tgtHllType, uint8_t lgConfigK);
87
+ static uint32_t hll4ArrBytes(uint8_t lgConfigK);
88
+ static uint32_t hll6ArrBytes(uint8_t lgConfigK);
89
+ static uint32_t hll8ArrBytes(uint8_t lgConfigK);
90
90
 
91
91
  virtual AuxHashMap<A>* getAuxHashMap() const;
92
92
 
@@ -98,16 +98,16 @@ class HllArray : public HllSketchImpl<A> {
98
98
 
99
99
  protected:
100
100
  void hipAndKxQIncrementalUpdate(uint8_t oldValue, uint8_t newValue);
101
- double getHllBitMapEstimate(int lgConfigK, int curMin, int numAtCurMin) const;
102
- double getHllRawEstimate(int lgConfigK, double kxqSum) const;
101
+ double getHllBitMapEstimate() const;
102
+ double getHllRawEstimate() const;
103
103
 
104
- double hipAccum;
105
- double kxq0;
106
- double kxq1;
107
- vector_u8<A> hllByteArr; //init by sub-classes
108
- int curMin; //always zero for Hll6 and Hll8, only tracked by Hll4Array
109
- int numAtCurMin; //interpreted as num zeros when curMin == 0
110
- bool oooFlag; //Out-Of-Order Flag
104
+ double hipAccum_;
105
+ double kxq0_;
106
+ double kxq1_;
107
+ vector_u8<A> hllByteArr_; //init by sub-classes
108
+ uint8_t curMin_; //always zero for Hll6 and Hll8, only tracked by Hll4Array
109
+ uint32_t numAtCurMin_; //interpreted as num zeros when curMin == 0
110
+ bool oooFlag_; //Out-Of-Order Flag
111
111
 
112
112
  friend class HllSketchImplFactory<A>;
113
113
  };
@@ -115,20 +115,20 @@ class HllArray : public HllSketchImpl<A> {
115
115
  template<typename A>
116
116
  class HllArray<A>::const_iterator: public std::iterator<std::input_iterator_tag, uint32_t> {
117
117
  public:
118
- const_iterator(const uint8_t* array, size_t array_slze, size_t index, target_hll_type hll_type, const AuxHashMap<A>* exceptions, uint8_t offset, bool all);
118
+ const_iterator(const uint8_t* array, uint32_t array_slze, uint32_t index, target_hll_type hll_type, const AuxHashMap<A>* exceptions, uint8_t offset, bool all);
119
119
  const_iterator& operator++();
120
120
  bool operator!=(const const_iterator& other) const;
121
121
  uint32_t operator*() const;
122
122
  private:
123
- const uint8_t* array;
124
- size_t array_size;
125
- size_t index;
126
- target_hll_type hll_type;
127
- const AuxHashMap<A>* exceptions;
128
- uint8_t offset;
129
- bool all;
130
- uint8_t value; // cached value to avoid computing in operator++ and in operator*()
131
- static inline uint8_t get_value(const uint8_t* array, size_t index, target_hll_type hll_type, const AuxHashMap<A>* exceptions, uint8_t offset);
123
+ const uint8_t* array_;
124
+ uint32_t array_size_;
125
+ uint32_t index_;
126
+ target_hll_type hll_type_;
127
+ const AuxHashMap<A>* exceptions_;
128
+ uint8_t offset_;
129
+ bool all_;
130
+ uint8_t value_; // cached value to avoid computing in operator++ and in operator*()
131
+ static inline uint8_t get_value(const uint8_t* array, uint32_t index, target_hll_type hll_type, const AuxHashMap<A>* exceptions, uint8_t offset);
132
132
  };
133
133
 
134
134
  }
@@ -42,7 +42,7 @@ typedef union {
42
42
  } longDoubleUnion;
43
43
 
44
44
  template<typename A>
45
- hll_sketch_alloc<A>::hll_sketch_alloc(int lg_config_k, target_hll_type tgt_type, bool start_full_size, const A& allocator) {
45
+ hll_sketch_alloc<A>::hll_sketch_alloc(uint8_t lg_config_k, target_hll_type tgt_type, bool start_full_size, const A& allocator) {
46
46
  HllUtil<A>::checkLgK(lg_config_k);
47
47
  if (start_full_size) {
48
48
  sketch_impl = HllSketchImplFactory<A>::newHll(lg_config_k, tgt_type, start_full_size, allocator);
@@ -122,7 +122,7 @@ void hll_sketch_alloc<A>::update(const std::string& datum) {
122
122
  }
123
123
 
124
124
  template<typename A>
125
- void hll_sketch_alloc<A>::update(const uint64_t datum) {
125
+ void hll_sketch_alloc<A>::update(uint64_t datum) {
126
126
  // no sign extension with 64 bits so no need to cast to signed value
127
127
  HashState hashResult;
128
128
  HllUtil<A>::hash(&datum, sizeof(uint64_t), DEFAULT_SEED, hashResult);
@@ -130,53 +130,53 @@ void hll_sketch_alloc<A>::update(const uint64_t datum) {
130
130
  }
131
131
 
132
132
  template<typename A>
133
- void hll_sketch_alloc<A>::update(const uint32_t datum) {
133
+ void hll_sketch_alloc<A>::update(uint32_t datum) {
134
134
  update(static_cast<int32_t>(datum));
135
135
  }
136
136
 
137
137
  template<typename A>
138
- void hll_sketch_alloc<A>::update(const uint16_t datum) {
138
+ void hll_sketch_alloc<A>::update(uint16_t datum) {
139
139
  update(static_cast<int16_t>(datum));
140
140
  }
141
141
 
142
142
  template<typename A>
143
- void hll_sketch_alloc<A>::update(const uint8_t datum) {
143
+ void hll_sketch_alloc<A>::update(uint8_t datum) {
144
144
  update(static_cast<int8_t>(datum));
145
145
  }
146
146
 
147
147
  template<typename A>
148
- void hll_sketch_alloc<A>::update(const int64_t datum) {
148
+ void hll_sketch_alloc<A>::update(int64_t datum) {
149
149
  HashState hashResult;
150
150
  HllUtil<A>::hash(&datum, sizeof(int64_t), DEFAULT_SEED, hashResult);
151
151
  coupon_update(HllUtil<A>::coupon(hashResult));
152
152
  }
153
153
 
154
154
  template<typename A>
155
- void hll_sketch_alloc<A>::update(const int32_t datum) {
156
- int64_t val = static_cast<int64_t>(datum);
155
+ void hll_sketch_alloc<A>::update(int32_t datum) {
156
+ const int64_t val = static_cast<int64_t>(datum);
157
157
  HashState hashResult;
158
158
  HllUtil<A>::hash(&val, sizeof(int64_t), DEFAULT_SEED, hashResult);
159
159
  coupon_update(HllUtil<A>::coupon(hashResult));
160
160
  }
161
161
 
162
162
  template<typename A>
163
- void hll_sketch_alloc<A>::update(const int16_t datum) {
164
- int64_t val = static_cast<int64_t>(datum);
163
+ void hll_sketch_alloc<A>::update(int16_t datum) {
164
+ const int64_t val = static_cast<int64_t>(datum);
165
165
  HashState hashResult;
166
166
  HllUtil<A>::hash(&val, sizeof(int64_t), DEFAULT_SEED, hashResult);
167
167
  coupon_update(HllUtil<A>::coupon(hashResult));
168
168
  }
169
169
 
170
170
  template<typename A>
171
- void hll_sketch_alloc<A>::update(const int8_t datum) {
172
- int64_t val = static_cast<int64_t>(datum);
171
+ void hll_sketch_alloc<A>::update(int8_t datum) {
172
+ const int64_t val = static_cast<int64_t>(datum);
173
173
  HashState hashResult;
174
174
  HllUtil<A>::hash(&val, sizeof(int64_t), DEFAULT_SEED, hashResult);
175
175
  coupon_update(HllUtil<A>::coupon(hashResult));
176
176
  }
177
177
 
178
178
  template<typename A>
179
- void hll_sketch_alloc<A>::update(const double datum) {
179
+ void hll_sketch_alloc<A>::update(double datum) {
180
180
  longDoubleUnion d;
181
181
  d.doubleBytes = static_cast<double>(datum);
182
182
  if (datum == 0.0) {
@@ -190,7 +190,7 @@ void hll_sketch_alloc<A>::update(const double datum) {
190
190
  }
191
191
 
192
192
  template<typename A>
193
- void hll_sketch_alloc<A>::update(const float datum) {
193
+ void hll_sketch_alloc<A>::update(float datum) {
194
194
  longDoubleUnion d;
195
195
  d.doubleBytes = static_cast<double>(datum);
196
196
  if (datum == 0.0) {
@@ -204,7 +204,7 @@ void hll_sketch_alloc<A>::update(const float datum) {
204
204
  }
205
205
 
206
206
  template<typename A>
207
- void hll_sketch_alloc<A>::update(const void* data, const size_t lengthBytes) {
207
+ void hll_sketch_alloc<A>::update(const void* data, size_t lengthBytes) {
208
208
  if (data == nullptr) { return; }
209
209
  HashState hashResult;
210
210
  HllUtil<A>::hash(data, lengthBytes, DEFAULT_SEED, hashResult);
@@ -212,8 +212,8 @@ void hll_sketch_alloc<A>::update(const void* data, const size_t lengthBytes) {
212
212
  }
213
213
 
214
214
  template<typename A>
215
- void hll_sketch_alloc<A>::coupon_update(int coupon) {
216
- if (coupon == HllUtil<A>::EMPTY) { return; }
215
+ void hll_sketch_alloc<A>::coupon_update(uint32_t coupon) {
216
+ if (coupon == hll_constants::EMPTY) { return; }
217
217
  HllSketchImpl<A>* result = this->sketch_impl->couponUpdate(coupon);
218
218
  if (result != this->sketch_impl) {
219
219
  this->sketch_impl->get_deleter()(this->sketch_impl);
@@ -246,10 +246,12 @@ string<A> hll_sketch_alloc<A>::to_string(const bool summary,
246
246
  const bool detail,
247
247
  const bool aux_detail,
248
248
  const bool all) const {
249
- std::basic_ostringstream<char, std::char_traits<char>, AllocChar<A>> os;
249
+ // Using a temporary stream for implementation here does not comply with AllocatorAwareContainer requirements.
250
+ // The stream does not support passing an allocator instance, and alternatives are complicated.
251
+ std::stringstream os;
250
252
  if (summary) {
251
253
  os << "### HLL sketch summary:" << std::endl
252
- << " Log Config K : " << get_lg_config_k() << std::endl
254
+ << " Log Config K : " << std::to_string(get_lg_config_k()) << std::endl
253
255
  << " Hll Target : " << type_as_string() << std::endl
254
256
  << " Current Mode : " << mode_as_string() << std::endl
255
257
  << " LB : " << get_lower_bound(1) << std::endl
@@ -258,7 +260,7 @@ string<A> hll_sketch_alloc<A>::to_string(const bool summary,
258
260
  << " OutOfOrder flag: " << (is_out_of_order_flag() ? "true" : "false") << std::endl;
259
261
  if (get_current_mode() == HLL) {
260
262
  HllArray<A>* hllArray = (HllArray<A>*) sketch_impl;
261
- os << " CurMin : " << hllArray->getCurMin() << std::endl
263
+ os << " CurMin : " << std::to_string(hllArray->getCurMin()) << std::endl
262
264
  << " NumAtCurMin : " << hllArray->getNumAtCurMin() << std::endl
263
265
  << " HipAccum : " << hllArray->getHipAccum() << std::endl
264
266
  << " KxQ0 : " << hllArray->getKxQ0() << std::endl
@@ -338,7 +340,7 @@ string<A> hll_sketch_alloc<A>::to_string(const bool summary,
338
340
  }
339
341
  }
340
342
 
341
- return os.str();
343
+ return string<A>(os.str().c_str(), sketch_impl->getAllocator());
342
344
  }
343
345
 
344
346
  template<typename A>
@@ -352,12 +354,12 @@ double hll_sketch_alloc<A>::get_composite_estimate() const {
352
354
  }
353
355
 
354
356
  template<typename A>
355
- double hll_sketch_alloc<A>::get_lower_bound(int numStdDev) const {
357
+ double hll_sketch_alloc<A>::get_lower_bound(uint8_t numStdDev) const {
356
358
  return sketch_impl->getLowerBound(numStdDev);
357
359
  }
358
360
 
359
361
  template<typename A>
360
- double hll_sketch_alloc<A>::get_upper_bound(int numStdDev) const {
362
+ double hll_sketch_alloc<A>::get_upper_bound(uint8_t numStdDev) const {
361
363
  return sketch_impl->getUpperBound(numStdDev);
362
364
  }
363
365
 
@@ -367,7 +369,7 @@ hll_mode hll_sketch_alloc<A>::get_current_mode() const {
367
369
  }
368
370
 
369
371
  template<typename A>
370
- int hll_sketch_alloc<A>::get_lg_config_k() const {
372
+ uint8_t hll_sketch_alloc<A>::get_lg_config_k() const {
371
373
  return sketch_impl->getLgConfigK();
372
374
  }
373
375
 
@@ -387,12 +389,12 @@ bool hll_sketch_alloc<A>::is_estimation_mode() const {
387
389
  }
388
390
 
389
391
  template<typename A>
390
- int hll_sketch_alloc<A>::get_updatable_serialization_bytes() const {
392
+ uint32_t hll_sketch_alloc<A>::get_updatable_serialization_bytes() const {
391
393
  return sketch_impl->getUpdatableSerializationBytes();
392
394
  }
393
395
 
394
396
  template<typename A>
395
- int hll_sketch_alloc<A>::get_compact_serialization_bytes() const {
397
+ uint32_t hll_sketch_alloc<A>::get_compact_serialization_bytes() const {
396
398
  return sketch_impl->getCompactSerializationBytes();
397
399
  }
398
400
 
@@ -435,23 +437,23 @@ std::string hll_sketch_alloc<A>::mode_as_string() const {
435
437
  }
436
438
 
437
439
  template<typename A>
438
- int hll_sketch_alloc<A>::get_max_updatable_serialization_bytes(const int lg_config_k,
440
+ uint32_t hll_sketch_alloc<A>::get_max_updatable_serialization_bytes(uint8_t lg_config_k,
439
441
  const target_hll_type tgtHllType) {
440
- int arrBytes;
442
+ uint32_t arrBytes;
441
443
  if (tgtHllType == target_hll_type::HLL_4) {
442
- const int auxBytes = 4 << HllUtil<A>::LG_AUX_ARR_INTS[lg_config_k];
444
+ const uint32_t auxBytes = 4 << hll_constants::LG_AUX_ARR_INTS[lg_config_k];
443
445
  arrBytes = HllArray<A>::hll4ArrBytes(lg_config_k) + auxBytes;
444
446
  } else if (tgtHllType == target_hll_type::HLL_6) {
445
447
  arrBytes = HllArray<A>::hll6ArrBytes(lg_config_k);
446
448
  } else { //HLL_8
447
449
  arrBytes = HllArray<A>::hll8ArrBytes(lg_config_k);
448
450
  }
449
- return HllUtil<A>::HLL_BYTE_ARR_START + arrBytes;
451
+ return hll_constants::HLL_BYTE_ARR_START + arrBytes;
450
452
  }
451
453
 
452
454
  template<typename A>
453
- double hll_sketch_alloc<A>::get_rel_err(const bool upperBound, const bool unioned,
454
- const int lg_config_k, const int numStdDev) {
455
+ double hll_sketch_alloc<A>::get_rel_err(bool upperBound, bool unioned,
456
+ uint8_t lg_config_k, uint8_t numStdDev) {
455
457
  return HllUtil<A>::getRelErr(upperBound, unioned, lg_config_k, numStdDev);
456
458
  }
457
459
 
@@ -26,12 +26,12 @@
26
26
  namespace datasketches {
27
27
 
28
28
  template<typename A>
29
- HllSketchImpl<A>::HllSketchImpl(const int lgConfigK, const target_hll_type tgtHllType,
30
- const hll_mode mode, const bool startFullSize)
31
- : lgConfigK(lgConfigK),
32
- tgtHllType(tgtHllType),
33
- mode(mode),
34
- startFullSize(startFullSize)
29
+ HllSketchImpl<A>::HllSketchImpl(uint8_t lgConfigK, target_hll_type tgtHllType,
30
+ hll_mode mode, bool startFullSize)
31
+ : lgConfigK_(lgConfigK),
32
+ tgtHllType_(tgtHllType),
33
+ mode_(mode),
34
+ startFullSize_(startFullSize)
35
35
  {
36
36
  }
37
37
 
@@ -40,7 +40,7 @@ HllSketchImpl<A>::~HllSketchImpl() {
40
40
  }
41
41
 
42
42
  template<typename A>
43
- target_hll_type HllSketchImpl<A>::extractTgtHllType(const uint8_t modeByte) {
43
+ target_hll_type HllSketchImpl<A>::extractTgtHllType(uint8_t modeByte) {
44
44
  switch ((modeByte >> 2) & 0x3) {
45
45
  case 0:
46
46
  return target_hll_type::HLL_4;
@@ -54,7 +54,7 @@ target_hll_type HllSketchImpl<A>::extractTgtHllType(const uint8_t modeByte) {
54
54
  }
55
55
 
56
56
  template<typename A>
57
- hll_mode HllSketchImpl<A>::extractCurMode(const uint8_t modeByte) {
57
+ hll_mode HllSketchImpl<A>::extractCurMode(uint8_t modeByte) {
58
58
  switch (modeByte & 0x3) {
59
59
  case 0:
60
60
  return hll_mode::LIST;
@@ -68,12 +68,12 @@ hll_mode HllSketchImpl<A>::extractCurMode(const uint8_t modeByte) {
68
68
  }
69
69
 
70
70
  template<typename A>
71
- uint8_t HllSketchImpl<A>::makeFlagsByte(const bool compact) const {
72
- uint8_t flags(0);
73
- flags |= (isEmpty() ? HllUtil<A>::EMPTY_FLAG_MASK : 0);
74
- flags |= (compact ? HllUtil<A>::COMPACT_FLAG_MASK : 0);
75
- flags |= (isOutOfOrderFlag() ? HllUtil<A>::OUT_OF_ORDER_FLAG_MASK : 0);
76
- flags |= (startFullSize ? HllUtil<A>::FULL_SIZE_FLAG_MASK : 0);
71
+ uint8_t HllSketchImpl<A>::makeFlagsByte(bool compact) const {
72
+ uint8_t flags = 0;
73
+ flags |= (isEmpty() ? hll_constants::EMPTY_FLAG_MASK : 0);
74
+ flags |= (compact ? hll_constants::COMPACT_FLAG_MASK : 0);
75
+ flags |= (isOutOfOrderFlag() ? hll_constants::OUT_OF_ORDER_FLAG_MASK : 0);
76
+ flags |= (startFullSize_ ? hll_constants::FULL_SIZE_FLAG_MASK : 0);
77
77
  return flags;
78
78
  }
79
79
 
@@ -92,7 +92,7 @@ template<typename A>
92
92
  uint8_t HllSketchImpl<A>::makeModeByte() const {
93
93
  uint8_t byte = 0;
94
94
 
95
- switch (mode) {
95
+ switch (mode_) {
96
96
  case LIST:
97
97
  byte = 0;
98
98
  break;
@@ -104,7 +104,7 @@ uint8_t HllSketchImpl<A>::makeModeByte() const {
104
104
  break;
105
105
  }
106
106
 
107
- switch (tgtHllType) {
107
+ switch (tgtHllType_) {
108
108
  case HLL_4:
109
109
  byte |= (0 << 2); // for completeness
110
110
  break;
@@ -121,27 +121,27 @@ uint8_t HllSketchImpl<A>::makeModeByte() const {
121
121
 
122
122
  template<typename A>
123
123
  HllSketchImpl<A>* HllSketchImpl<A>::reset() {
124
- return HllSketchImplFactory<A>::reset(this, startFullSize);
124
+ return HllSketchImplFactory<A>::reset(this, startFullSize_);
125
125
  }
126
126
 
127
127
  template<typename A>
128
128
  target_hll_type HllSketchImpl<A>::getTgtHllType() const {
129
- return tgtHllType;
129
+ return tgtHllType_;
130
130
  }
131
131
 
132
132
  template<typename A>
133
- int HllSketchImpl<A>::getLgConfigK() const {
134
- return lgConfigK;
133
+ uint8_t HllSketchImpl<A>::getLgConfigK() const {
134
+ return lgConfigK_;
135
135
  }
136
136
 
137
137
  template<typename A>
138
138
  hll_mode HllSketchImpl<A>::getCurMode() const {
139
- return mode;
139
+ return mode_;
140
140
  }
141
141
 
142
142
  template<typename A>
143
143
  bool HllSketchImpl<A>::isStartFullSize() const {
144
- return startFullSize;
144
+ return startFullSize_;
145
145
  }
146
146
 
147
147
  }
@@ -30,7 +30,7 @@ namespace datasketches {
30
30
  template<typename A>
31
31
  class HllSketchImpl {
32
32
  public:
33
- HllSketchImpl(int lgConfigK, target_hll_type tgtHllType, hll_mode mode, bool startFullSize);
33
+ HllSketchImpl(uint8_t lgConfigK, target_hll_type tgtHllType, hll_mode mode, bool startFullSize);
34
34
  virtual ~HllSketchImpl();
35
35
 
36
36
  virtual void serialize(std::ostream& os, bool compact) const = 0;
@@ -42,25 +42,25 @@ class HllSketchImpl {
42
42
 
43
43
  virtual std::function<void(HllSketchImpl<A>*)> get_deleter() const = 0;
44
44
 
45
- virtual HllSketchImpl* couponUpdate(int coupon) = 0;
45
+ virtual HllSketchImpl* couponUpdate(uint32_t coupon) = 0;
46
46
 
47
47
  hll_mode getCurMode() const;
48
48
 
49
49
  virtual double getEstimate() const = 0;
50
50
  virtual double getCompositeEstimate() const = 0;
51
- virtual double getUpperBound(int numStdDev) const = 0;
52
- virtual double getLowerBound(int numStdDev) const = 0;
51
+ virtual double getUpperBound(uint8_t numStdDev) const = 0;
52
+ virtual double getLowerBound(uint8_t numStdDev) const = 0;
53
53
 
54
- inline int getLgConfigK() const;
54
+ inline uint8_t getLgConfigK() const;
55
55
 
56
- virtual int getMemDataStart() const = 0;
56
+ virtual uint32_t getMemDataStart() const = 0;
57
57
 
58
- virtual int getPreInts() const = 0;
58
+ virtual uint8_t getPreInts() const = 0;
59
59
 
60
60
  target_hll_type getTgtHllType() const;
61
61
 
62
- virtual int getUpdatableSerializationBytes() const = 0;
63
- virtual int getCompactSerializationBytes() const = 0;
62
+ virtual uint32_t getUpdatableSerializationBytes() const = 0;
63
+ virtual uint32_t getCompactSerializationBytes() const = 0;
64
64
 
65
65
  virtual bool isCompact() const = 0;
66
66
  virtual bool isEmpty() const = 0;
@@ -75,10 +75,10 @@ class HllSketchImpl {
75
75
  uint8_t makeFlagsByte(bool compact) const;
76
76
  uint8_t makeModeByte() const;
77
77
 
78
- const int lgConfigK;
79
- const target_hll_type tgtHllType;
80
- const hll_mode mode;
81
- const bool startFullSize;
78
+ const uint8_t lgConfigK_;
79
+ const target_hll_type tgtHllType_;
80
+ const hll_mode mode_;
81
+ const bool startFullSize_;
82
82
  };
83
83
 
84
84
  }
@@ -39,7 +39,7 @@ public:
39
39
 
40
40
  static CouponHashSet<A>* promoteListToSet(const CouponList<A>& list);
41
41
  static HllArray<A>* promoteListOrSetToHll(const CouponList<A>& list);
42
- static HllArray<A>* newHll(int lgConfigK, target_hll_type tgtHllType, bool startFullSize, const A& allocator);
42
+ static HllArray<A>* newHll(uint8_t lgConfigK, target_hll_type tgtHllType, bool startFullSize, const A& allocator);
43
43
 
44
44
  // resets the input impl, deleting the input pointer and returning a new pointer
45
45
  static HllSketchImpl<A>* reset(HllSketchImpl<A>* impl, bool startFullSize);
@@ -53,7 +53,7 @@ template<typename A>
53
53
  CouponHashSet<A>* HllSketchImplFactory<A>::promoteListToSet(const CouponList<A>& list) {
54
54
  using ChsAlloc = typename std::allocator_traits<A>::template rebind_alloc<CouponHashSet<A>>;
55
55
  CouponHashSet<A>* chSet = new (ChsAlloc(list.getAllocator()).allocate(1)) CouponHashSet<A>(list.getLgConfigK(), list.getTgtHllType(), list.getAllocator());
56
- for (auto coupon: list) {
56
+ for (const auto coupon: list) {
57
57
  chSet->couponUpdate(coupon);
58
58
  }
59
59
  return chSet;
@@ -63,7 +63,7 @@ template<typename A>
63
63
  HllArray<A>* HllSketchImplFactory<A>::promoteListOrSetToHll(const CouponList<A>& src) {
64
64
  HllArray<A>* tgtHllArr = HllSketchImplFactory<A>::newHll(src.getLgConfigK(), src.getTgtHllType(), false, src.getAllocator());
65
65
  tgtHllArr->putKxQ0(1 << src.getLgConfigK());
66
- for (auto coupon: src) {
66
+ for (const auto coupon: src) {
67
67
  tgtHllArr->couponUpdate(coupon);
68
68
  }
69
69
  tgtHllArr->putHipAccum(src.getEstimate());
@@ -75,12 +75,12 @@ template<typename A>
75
75
  HllSketchImpl<A>* HllSketchImplFactory<A>::deserialize(std::istream& is, const A& allocator) {
76
76
  // we'll hand off the sketch based on PreInts so we don't need
77
77
  // to move the stream pointer back and forth -- perhaps somewhat fragile?
78
- const int preInts = is.peek();
79
- if (preInts == HllUtil<A>::HLL_PREINTS) {
78
+ const uint8_t preInts = static_cast<uint8_t>(is.peek());
79
+ if (preInts == hll_constants::HLL_PREINTS) {
80
80
  return HllArray<A>::newHll(is, allocator);
81
- } else if (preInts == HllUtil<A>::HASH_SET_PREINTS) {
81
+ } else if (preInts == hll_constants::HASH_SET_PREINTS) {
82
82
  return CouponHashSet<A>::newSet(is, allocator);
83
- } else if (preInts == HllUtil<A>::LIST_PREINTS) {
83
+ } else if (preInts == hll_constants::LIST_PREINTS) {
84
84
  return CouponList<A>::newList(is, allocator);
85
85
  } else {
86
86
  throw std::invalid_argument("Attempt to deserialize unknown object type");
@@ -90,12 +90,12 @@ HllSketchImpl<A>* HllSketchImplFactory<A>::deserialize(std::istream& is, const A
90
90
  template<typename A>
91
91
  HllSketchImpl<A>* HllSketchImplFactory<A>::deserialize(const void* bytes, size_t len, const A& allocator) {
92
92
  // read current mode directly
93
- const int preInts = static_cast<const uint8_t*>(bytes)[0];
94
- if (preInts == HllUtil<A>::HLL_PREINTS) {
93
+ const uint8_t preInts = static_cast<const uint8_t*>(bytes)[0];
94
+ if (preInts == hll_constants::HLL_PREINTS) {
95
95
  return HllArray<A>::newHll(bytes, len, allocator);
96
- } else if (preInts == HllUtil<A>::HASH_SET_PREINTS) {
96
+ } else if (preInts == hll_constants::HASH_SET_PREINTS) {
97
97
  return CouponHashSet<A>::newSet(bytes, len, allocator);
98
- } else if (preInts == HllUtil<A>::LIST_PREINTS) {
98
+ } else if (preInts == hll_constants::LIST_PREINTS) {
99
99
  return CouponList<A>::newList(bytes, len, allocator);
100
100
  } else {
101
101
  throw std::invalid_argument("Attempt to deserialize unknown object type");
@@ -103,7 +103,7 @@ HllSketchImpl<A>* HllSketchImplFactory<A>::deserialize(const void* bytes, size_t
103
103
  }
104
104
 
105
105
  template<typename A>
106
- HllArray<A>* HllSketchImplFactory<A>::newHll(int lgConfigK, target_hll_type tgtHllType, bool startFullSize, const A& allocator) {
106
+ HllArray<A>* HllSketchImplFactory<A>::newHll(uint8_t lgConfigK, target_hll_type tgtHllType, bool startFullSize, const A& allocator) {
107
107
  switch (tgtHllType) {
108
108
  case HLL_8:
109
109
  using Hll8Alloc = typename std::allocator_traits<A>::template rebind_alloc<Hll8Array<A>>;
@@ -134,7 +134,7 @@ HllSketchImpl<A>* HllSketchImplFactory<A>::reset(HllSketchImpl<A>* impl, bool st
134
134
 
135
135
  template<typename A>
136
136
  Hll4Array<A>* HllSketchImplFactory<A>::convertToHll4(const HllArray<A>& srcHllArr) {
137
- const int lgConfigK = srcHllArr.getLgConfigK();
137
+ const uint8_t lgConfigK = srcHllArr.getLgConfigK();
138
138
  using Hll4Alloc = typename std::allocator_traits<A>::template rebind_alloc<Hll4Array<A>>;
139
139
  Hll4Array<A>* hll4Array = new (Hll4Alloc(srcHllArr.getAllocator()).allocate(1))
140
140
  Hll4Array<A>(lgConfigK, srcHllArr.isStartFullSize(), srcHllArr.getAllocator());
@@ -146,7 +146,7 @@ Hll4Array<A>* HllSketchImplFactory<A>::convertToHll4(const HllArray<A>& srcHllAr
146
146
 
147
147
  template<typename A>
148
148
  Hll6Array<A>* HllSketchImplFactory<A>::convertToHll6(const HllArray<A>& srcHllArr) {
149
- const int lgConfigK = srcHllArr.getLgConfigK();
149
+ const uint8_t lgConfigK = srcHllArr.getLgConfigK();
150
150
  using Hll6Alloc = typename std::allocator_traits<A>::template rebind_alloc<Hll6Array<A>>;
151
151
  Hll6Array<A>* hll6Array = new (Hll6Alloc(srcHllArr.getAllocator()).allocate(1))
152
152
  Hll6Array<A>(lgConfigK, srcHllArr.isStartFullSize(), srcHllArr.getAllocator());
@@ -158,7 +158,7 @@ Hll6Array<A>* HllSketchImplFactory<A>::convertToHll6(const HllArray<A>& srcHllAr
158
158
 
159
159
  template<typename A>
160
160
  Hll8Array<A>* HllSketchImplFactory<A>::convertToHll8(const HllArray<A>& srcHllArr) {
161
- const int lgConfigK = srcHllArr.getLgConfigK();
161
+ const uint8_t lgConfigK = srcHllArr.getLgConfigK();
162
162
  using Hll8Alloc = typename std::allocator_traits<A>::template rebind_alloc<Hll8Array<A>>;
163
163
  Hll8Array<A>* hll8Array = new (Hll8Alloc(srcHllArr.getAllocator()).allocate(1))
164
164
  Hll8Array<A>(lgConfigK, srcHllArr.isStartFullSize(), srcHllArr.getAllocator());