diff options
Diffstat (limited to 'src/common/bitpacker.rs')
-rw-r--r-- | src/common/bitpacker.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/common/bitpacker.rs b/src/common/bitpacker.rs index ab3d59d..456328b 100644 --- a/src/common/bitpacker.rs +++ b/src/common/bitpacker.rs @@ -135,16 +135,16 @@ where let val_shifted = (val_unshifted_unmasked >> bit_shift) as u64; (val_shifted & mask) } else { - let val_unshifted_unmasked: u64; - if addr + 8 <= data.len() { - val_unshifted_unmasked = unsafe { *(data[addr..].as_ptr() as *const u64) }; - } else { - let mut buffer = [0u8; 8]; - for i in addr..data.len() { - buffer[i - addr] += data[i]; - } - val_unshifted_unmasked = unsafe { *(buffer[..].as_ptr() as *const u64) }; - } + let val_unshifted_unmasked: u64 = + if addr + 8 <= data.len() { + unsafe { *(data[addr..].as_ptr() as *const u64) } + } else { + let mut buffer = [0u8; 8]; + for i in addr..data.len() { + buffer[i - addr] += data[i]; + } + unsafe { *(buffer[..].as_ptr() as *const u64) } + }; let val_shifted = (val_unshifted_unmasked >> bit_shift) as u64; (val_shifted & mask) } |