Class: Omnizip::Algorithms::Zstandard::FSE::TableDescription::BitReader

Inherits:
Object
  • Object
show all
Defined in:
lib/omnizip/algorithms/zstandard/fse/table_description.rb

Overview

Forward little-endian bit reader over a byte string with a sliding 32-bit window (C FSE_readNCount's bit reader).

Instance Method Summary collapse

Constructor Details

#initialize(src) ⇒ BitReader

Returns a new instance of BitReader.



155
156
157
158
159
160
# File 'lib/omnizip/algorithms/zstandard/fse/table_description.rb', line 155

def initialize(src)
  @src = src
  @byte_pos = 0
  @bit_count = 0
  @bit_window = read_u32(0)
end

Instance Method Details

#bytes_consumedObject



170
171
172
# File 'lib/omnizip/algorithms/zstandard/fse/table_description.rb', line 170

def bytes_consumed
  @byte_pos + ((@bit_count + 7) >> 3)
end

#peekObject



162
163
164
# File 'lib/omnizip/algorithms/zstandard/fse/table_description.rb', line 162

def peek
  @bit_window
end

#skip_bits(bits) ⇒ Object



166
167
168
# File 'lib/omnizip/algorithms/zstandard/fse/table_description.rb', line 166

def skip_bits(bits)
  refill(bits)
end