Update bitpacker/src/bitpacker.rs

Co-authored-by: Paul Masurel <paul@quickwit.io>
This commit is contained in:
PSeitz
2026-09-23 20:21:08 +08:00
co-authored by Paul Masurel
parent 21a6913217
commit f5fb40950a
+2
View File
@@ -132,6 +132,8 @@ impl BitUnpacker {
// Fall back for ranges overlapping the end, where an eight-byte load would be partial.
let last_bit_addr = (start_idx + output.len() - 1) * self.num_bits;
// The optimization happening below requires reading full 8 bytes word.
// We check that data is long enough to allow for the last read, and if not, fall back for the following safe implementation
if (last_bit_addr >> 3) + 8 > data.len() {
for (offset, out) in output.iter_mut().enumerate() {
*out = self.get((start_idx + offset) as u32, data);