Unpack a full bitpacked buffer (with 3-byte header) using SIMD.
(buf: &[u8])
| 50 | |
| 51 | /// Unpack a full bitpacked buffer (with 3-byte header) using SIMD. |
| 52 | pub fn unpack_simd(buf: &[u8]) -> Vec<u32> { |
| 53 | if buf.len() < 3 { |
| 54 | return Vec::new(); |
| 55 | } |
| 56 | let num_values = u16::from_le_bytes([buf[0], buf[1]]) as usize; |
| 57 | let bit_width = buf[2]; |
| 58 | unpack(&buf[3..], bit_width, num_values) |
| 59 | } |
| 60 | |
| 61 | #[cfg(test)] |
| 62 | mod tests { |