Return the outlier `(dim_index, value)` for the dimension at position `slot` in the bitmask. `slot` is the dimension index (0–63). Returns `None` if the bit for `slot` is not set in `outlier_bitmask`, or if `slot ≥ 64`. Uses a branchless popcnt to find the dense offset into the outlier payload.
(&self, slot: u32)
| 242 | /// Uses a branchless popcnt to find the dense offset into the outlier |
| 243 | /// payload. |
| 244 | pub fn outlier_at(&self, slot: u32) -> Option<(u32, f32)> { |
| 245 | if slot >= 64 { |
| 246 | return None; |
| 247 | } |
| 248 | let bitmask = self.header().outlier_bitmask; |
| 249 | if bitmask & (1u64 << slot) == 0 { |
| 250 | return None; |
| 251 | } |
| 252 | // Number of set bits below `slot` gives the dense array index. |
| 253 | let mask = bitmask & ((1u64 << slot).wrapping_sub(1)); |
| 254 | let offset = mask.count_ones() as usize; |
| 255 | |
| 256 | let header_bytes = core::mem::size_of::<QuantHeader>(); |
| 257 | let base = header_bytes + self.packed_bits_len + offset * OUTLIER_ENTRY_BYTES; |
| 258 | |
| 259 | let dim_idx = u32::from_le_bytes(self.buf[base..base + 4].try_into().ok()?); |
| 260 | let value = f32::from_le_bytes(self.buf[base + 4..base + 8].try_into().ok()?); |
| 261 | Some((dim_idx, value)) |
| 262 | } |
| 263 | |
| 264 | /// Full backing buffer suitable for direct I/O. |
| 265 | #[inline] |