Extract the top `prefix_bits` bits of a Hilbert prefix as a bucket index.
(hilbert_prefix: u64, prefix_bits: u8)
| 109 | |
| 110 | /// Extract the top `prefix_bits` bits of a Hilbert prefix as a bucket index. |
| 111 | fn prefix_bucket(hilbert_prefix: u64, prefix_bits: u8) -> u32 { |
| 112 | // Shift right so the top `prefix_bits` bits are in the low-order position. |
| 113 | let shift = 64u8.saturating_sub(prefix_bits); |
| 114 | (hilbert_prefix >> shift) as u32 |
| 115 | } |
| 116 | |
| 117 | /// Map a bucket index to the primary vShard in that bucket's range. |
| 118 | fn bucket_to_vshard(bucket: u32, prefix_bits: u8) -> u32 { |
no outgoing calls
no test coverage detected