Module: ReadBitsAtOffset

Included in:
Innodb::DataType::RollPointerType, Innodb::Page::FspHdrXdes, Innodb::Page::IbufBitmap
Defined in:
lib/innodb/util/read_bits_at_offset.rb

Instance Method Summary collapse

Instance Method Details

#read_bits_at_offset(data, bits, offset) ⇒ Object

Read a given number of bits from an integer at a specific bit offset. The value returned is 0-based so does not need further shifting or adjustment.



4
5
6
# File 'lib/innodb/util/read_bits_at_offset.rb', line 4

def read_bits_at_offset(data, bits, offset)
  ((data & (((1 << bits) - 1) << offset)) >> offset)
end