Compute the buffer size (rounded up to a 128-byte multiple) required to hold a [`UnifiedQuantizedVector`] with the given parameters. This is the pre-sizing helper for callers that want to allocate before constructing.
(quant_mode: QuantMode, dim: u16, outlier_count: u32)
| 103 | /// This is the pre-sizing helper for callers that want to allocate before |
| 104 | /// constructing. |
| 105 | pub fn target_size(quant_mode: QuantMode, dim: u16, outlier_count: u32) -> usize { |
| 106 | let packed_bits_bytes = packed_bits_len(quant_mode, dim); |
| 107 | let outlier_bytes = outlier_count as usize * OUTLIER_ENTRY_BYTES; |
| 108 | let raw = core::mem::size_of::<QuantHeader>() + packed_bits_bytes + outlier_bytes; |
| 109 | round_up_128(raw) |
| 110 | } |
| 111 | |
| 112 | // ── Internal helpers ──────────────────────────────────────────────────────── |
| 113 |