pub struct ReverseBitReader<'a> { /* private fields */ }Expand description
Reverse bitstream reader using C zstd’s bitsConsumed model.
Instead of tracking bits_available (decrement on consume, increment on refill),
this tracks bits_consumed (increment on consume, reset on reload). Peek uses
a double-shift: (container << consumed) >> (64 - n) = 2 ops vs the old model’s
3 ops (shift + mask + subtract).
Implementations§
Source§impl<'a> ReverseBitReader<'a>
impl<'a> ReverseBitReader<'a>
pub fn new(data: &'a [u8]) -> Result<Self, DecompressError>
pub fn refill(&mut self)
pub fn read_bits(&mut self, n: u8) -> Result<u32, DecompressError>
pub fn consume_bits(&mut self, n: u8)
pub fn read_bits_branchless(&mut self, n: u8) -> u32
pub fn try_refill_fast(&mut self) -> bool
pub fn refill_fast_or_regular(&mut self)
pub fn ptr(&self) -> usize
pub fn limit_ptr(&self) -> usize
pub fn peek_bits(&self, n: u8) -> u32
pub fn bits_remaining(&self) -> usize
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl<'a> Freeze for ReverseBitReader<'a>
impl<'a> RefUnwindSafe for ReverseBitReader<'a>
impl<'a> Send for ReverseBitReader<'a>
impl<'a> Sync for ReverseBitReader<'a>
impl<'a> Unpin for ReverseBitReader<'a>
impl<'a> UnsafeUnpin for ReverseBitReader<'a>
impl<'a> UnwindSafe for ReverseBitReader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more