Module: RadixEncoding::Encoding::Chunks

Included in:
RadixEncoding::Encoding
Defined in:
lib/radix_encoding/encoding/chunks.rb

Instance Method Summary collapse

Instance Method Details

#chunk_bitsizeObject

Raises:

  • (NotImplementedError)


6
7
8
# File 'lib/radix_encoding/encoding/chunks.rb', line 6

def chunk_bitsize
  raise NotImplementedError
end

#chunks_total_bitsize_for(bits) ⇒ Object



10
11
12
# File 'lib/radix_encoding/encoding/chunks.rb', line 10

def chunks_total_bitsize_for(bits)
  count_chunks_in(bits) * chunk_bitsize
end

#count_chunks_in(bits) ⇒ Object



14
15
16
# File 'lib/radix_encoding/encoding/chunks.rb', line 14

def count_chunks_in(bits)
  (bits.size / chunk_bitsize.to_f).ceil
end