Returns an index into 'buildPartitionBounds_' given an index into tags of the HashTable.
| 1115 | // Returns an index into 'buildPartitionBounds_' given an index into tags of the |
| 1116 | // HashTable. |
| 1117 | int32_t findPartition( |
| 1118 | PartitionBoundIndexType index, |
| 1119 | const PartitionBoundIndexType* bounds, |
| 1120 | int32_t numPartitions) { |
| 1121 | // The partition bounds are padded to batch size. |
| 1122 | constexpr int32_t kBatch = xsimd::batch<PartitionBoundIndexType>::size; |
| 1123 | auto indexVector = xsimd::batch<PartitionBoundIndexType>::broadcast(index); |
| 1124 | for (auto i = 1; i < numPartitions; i += kBatch) { |
| 1125 | auto bits = simd::toBitMask( |
| 1126 | indexVector < |
| 1127 | xsimd::batch<PartitionBoundIndexType>::load_unaligned(bounds + i)); |
| 1128 | if (bits) { |
| 1129 | return i + __builtin_ctz(bits) - 1; |
| 1130 | } |
| 1131 | } |
| 1132 | BOLT_UNREACHABLE("Partition index out of range"); |
| 1133 | } |
| 1134 | } // namespace |
| 1135 | |
| 1136 | template <bool ignoreNullKeys> |
no test coverage detected