Module: Packable::Extensions::Integer::ClassMethods
- Defined in:
- lib/packable/extensions/integer.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#unpack_string(s, options) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/packable/extensions/integer.rb', line 36 def unpack_string(s,) s = s.reverse if NEEDS_REVERSAL[[:endian]] r = 0 s.each_byte {|b| r = (r << 8) + b} r -= 1 << (8 * [:bytes]) if [:signed] && (1 == r >> (8 * [:bytes] - 1)) r end |