Module: LXP::Utils
- Defined in:
- lib/lxp/utils.rb
Class Method Summary collapse
Class Method Details
.int(bytes) ⇒ Object
7 8 9 10 11 |
# File 'lib/lxp/utils.rb', line 7 def int(bytes) bytes.each_with_index.map do |b, idx| b << (idx * 8) end.inject(:|) end |
.int_complement(bytes) ⇒ Object
13 14 15 16 17 |
# File 'lib/lxp/utils.rb', line 13 def int_complement(bytes) r = int(bytes) r -= 0x10000 if r & 0x8000 == 0x8000 r end |