@@ -13,10 +13,15 @@ struct Bucket {
1313};
1414#pragma pack(pop)
1515
16- typedef col_hash_t [2 ] ColumnDepths;
17-
1816namespace SketchBucket {
1917
18+ struct Depths {
19+ private:
20+ col_hash_t depths[2 ];
21+ public:
22+ col_hash_t & operator [](size_t i) { return depths[i]; }
23+ };
24+
2025static constexpr size_t col_hash_bits = sizeof (col_hash_t ) * 8 ;
2126/* *
2227 * Hashes the column index and the update index together to determine the depth of an update
@@ -33,16 +38,16 @@ inline static col_hash_t get_index_depth(const vec_t update_idx, const long seed
3338 return __builtin_ctzll (depth_hash);
3439}
3540
36- inline static depths get_index_depths (vec_t update_idx, size_t seed, col_hash_t max_depth) {
37- col_hash_t depth_hash = col_hash (&update_idx, sizeof (vec_t ), seed);
38- depths ret;
41+ inline static Depths get_index_depths (vec_t update_idx, size_t seed, col_hash_t max_depth) {
42+ uint64_t depth_hash = col_hash (&update_idx, sizeof (vec_t ), seed);
43+ Depths ret;
3944
4045 depth_hash |= (1ull << max_depth); // assert not > max_depth by ORing
4146 ret[0 ] = __builtin_ctzll (depth_hash);
4247
4348 // shift hash over and reassert max_depth
4449 depth_hash >>= 32 ;
45- depth_hash depth_hash |= (1ull << max_depth);
50+ depth_hash |= (1ull << max_depth);
4651 ret[1 ] = __builtin_ctzll (depth_hash);
4752
4853 return ret;
@@ -56,7 +61,7 @@ inline static depths get_index_depths(vec_t update_idx, size_t seed, col_hash_t
5661 * @return The depth of the bucket to update
5762 */
5863inline static vec_hash_t get_index_hash (const vec_t index, const long sketch_seed) {
59- return vec_hash (&update_idx , sizeof (vec_t ), sketch_seed);
64+ return vec_hash (&index , sizeof (vec_t ), sketch_seed);
6065}
6166
6267/* *
0 commit comments