diff --git a/cpp/src/arrow/compute/key_map_internal.cc b/cpp/src/arrow/compute/key_map_internal.cc index b1fc8fb4f8e67..bbaf21ec4e25e 100644 --- a/cpp/src/arrow/compute/key_map_internal.cc +++ b/cpp/src/arrow/compute/key_map_internal.cc @@ -258,11 +258,6 @@ uint64_t SwissTable::num_groups_for_resize() const { } } -uint32_t SwissTable::wrap_global_slot_id(uint32_t global_slot_id) const { - uint32_t global_slot_id_mask = static_cast((1ULL << (log_blocks_ + 3)) - 1); - return global_slot_id & global_slot_id_mask; -} - void SwissTable::early_filter(const int num_keys, const uint32_t* hashes, uint8_t* out_match_bitvector, uint8_t* out_local_slots) const { @@ -362,7 +357,7 @@ bool SwissTable::find_next_stamp_match(const uint32_t hash, const uint32_t in_sl constexpr uint64_t stamp_mask = 0x7f; const int stamp = static_cast((hash >> bits_shift_for_block_and_stamp_) & stamp_mask); - uint32_t start_slot_id = wrap_global_slot_id(in_slot_id); + uint32_t start_slot_id = in_slot_id; int match_found; int local_slot; uint8_t* blockbase; @@ -372,7 +367,7 @@ bool SwissTable::find_next_stamp_match(const uint32_t hash, const uint32_t in_sl search_block(block, stamp, start_slot_id & 7, &local_slot, &match_found); - start_slot_id = wrap_global_slot_id(start_slot_id & ~7U + local_slot + match_found); + start_slot_id = (start_slot_id & ~7U) + local_slot + match_found; // Match found can be 1 in two cases: // - match was found diff --git a/cpp/src/arrow/compute/key_map_internal.h b/cpp/src/arrow/compute/key_map_internal.h index 5ef83b853efe6..3c8b9bf47c983 100644 --- a/cpp/src/arrow/compute/key_map_internal.h +++ b/cpp/src/arrow/compute/key_map_internal.h @@ -168,8 +168,6 @@ class ARROW_EXPORT SwissTable { inline uint64_t num_groups_for_resize() const; - inline uint32_t wrap_global_slot_id(uint32_t global_slot_id) const; - void init_slot_ids(const int num_keys, const uint16_t* selection, const uint32_t* hashes, const uint8_t* local_slots, const uint8_t* match_bitvector, uint32_t* out_slot_ids) const; @@ -266,24 +264,6 @@ class ARROW_EXPORT SwissTable { MemoryPool* pool_; }; -// uint32_t SwissTable::extract_group_id(const uint8_t* block_ptr, int slot, -// uint64_t group_id_mask) const { -// // Group id values for all 8 slots in the block are bit-packed and follow the status -// // bytes. We assume here that the number of bits is rounded up to 8, 16, 32 or 64. In -// // that case we can extract group id using aligned 64-bit word access. -// int num_group_id_bits = static_cast(ARROW_POPCOUNT64(group_id_mask)); -// assert(num_group_id_bits == 8 || num_group_id_bits == 16 || num_group_id_bits == 32 -// || -// num_group_id_bits == 64); - -// int bit_offset = slot * num_group_id_bits; -// const uint64_t* group_id_bytes = -// reinterpret_cast(block_ptr) + 1 + (bit_offset >> 6); -// uint64_t group_id = (*group_id_bytes >> (bit_offset & 63)) & group_id_mask; - -// return group_id; -// } - void SwissTable::insert_into_empty_slot(uint32_t slot_id, uint32_t hash, uint32_t group_id) { const int64_t num_groupid_bits = num_groupid_bits_from_log_blocks(log_blocks_);