struct

Brotli::BitReader

Inherits Struct < Value < Object

Constants

FAST_INPUT_SLACK = 28

162 bits + 7 bytes (upstream bit_reader.h).

Constructors

new(input : Bytes, next_in : Int32 = 0, avail_in : Int32 = 0)
Source

Class methods

bit_mask(n : Int32) : UInt64
Source

Instance methods

avail_in
Source
available_bits
Source
check_input_amount

BrotliCheckInputAmount: >= FAST_INPUT_SLACK bytes left in input.

Source
copy_bytes(dest : Bytes, num : Int32) : Nil

BrotliCopyBytes (num <= remaining_bytes).

Source
drop_bits(n : Int32) : Nil

BrotliDropBits

Source
drop_bytes(num : Int32) : Nil

BrotliDropBytes: precondition — accumulator is byte-empty.

Source
fill_bit_window

BrotliFillBitWindow — general branch only (see file comment).

Source
fill_bit_window16

BrotliFillBitWindow16

Source
get16_bits_unmasked

BrotliGet16BitsUnmasked

Source
get_bits(n : Int32) : UInt64

BrotliGetBits: peek n bits without advancing.

Source
get_bits_unmasked

BrotliGetBitsUnmasked

Source
guard_in
Source
init

BrotliInitBitReader

Source
jump_to_byte_boundary

BrotliJumpToByteBoundary: false if the skipped pad bits are non-zero.

Source
last_in
Source
next_in
Source
normalize

BrotliBitReaderNormalize: drop "spectre" bits above bit_pos.

Source
pull_byte

BrotliPullByte

Source
read_bits24(n : Int32) : UInt64

BrotliReadBits24 (n <= 24; 64-bit build — single window fill).

Source
read_bits32(n : Int32) : UInt64

BrotliReadBits32 (n <= 32; 64-bit build).

Source
remaining_bytes

BrotliGetRemainingBytes

Source
restore_state(from : Memento) : Nil
Source
safe_get_bits(n : Int32) : UInt64 | Nil

BrotliSafeGetBits: nil if there is not enough input.

Source
safe_read_bits(n : Int32) : UInt64 | Nil

BrotliSafeReadBits (n <= 24): nil if there is not enough input.

Source
safe_read_bits32(n : Int32) : UInt64 | Nil

BrotliSafeReadBits32 (n <= 32; 64-bit build).

Source
save_state
Source
set_input(input : Bytes, next_in : Int32, avail_in : Int32) : Nil

Switch the underlying input slice (C re-points br->next_in into s->buffer for the internal streaming buffer).

Source
set_input(next_in : Int32, avail_in : Int32) : Nil

BrotliBitReaderSetInput

Source
take_bits(n : Int32) : UInt64

BrotliTakeBits: precondition — accumulator holds >= n bits.

Source
unload

BrotliBitReaderUnload: return unconsumed whole bytes to the input.

Source
warmup?

BrotliWarmupBitReader (UNALIGNED_READ_FAST build: no alignment fixup).

Source

Nested types