Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/ffi/struct_ex/struct_ex.rb

Instance Method Summary collapse

Instance Method Details

#to_signed(bits_size) ⇒ Object



4
5
6
# File 'lib/ffi/struct_ex/struct_ex.rb', line 4

def to_signed(bits_size)
  self & (1 << bits_size - 1) != 0 ? self - (1 << bits_size) : self
end