Class: FFI::Chm::Struct::SR

Inherits:
BinData::Primitive
  • Object
show all
Includes:
Shortcut
Defined in:
lib/ffi-chm/struct/sr.rb

Defined Under Namespace

Modules: Shortcut

Instance Method Summary collapse

Methods included from Shortcut

#bits, #prefix

Instance Method Details

#getObject



12
13
14
15
16
17
# File 'lib/ffi-chm/struct/sr.rb', line 12

def get
  size = prefix.size
  ret = bits.inject(0){|r, v| r << 1 | v}
  ret += 2 << (eval_parameter(:r) + size - 3) if size > 1
  ret
end

#num_bitsObject



8
9
10
# File 'lib/ffi-chm/struct/sr.rb', line 8

def num_bits
  eval_parameter(:r) + [0, prefix.size - 2].max
end