lib/ronin/formatting/extensions/binary/integer.rb in ronin-support-0.5.0.rc2 vs lib/ronin/formatting/extensions/binary/integer.rb in ronin-support-0.5.0
- old
+ new
@@ -58,20 +58,20 @@
def bytes(length,endian=:little)
endian = endian.to_sym
buffer = []
case endian
- when :little, :net
+ when :little
mask = 0xff
shift = 0
length.times do |i|
buffer << ((self & mask) >> shift)
mask <<= 8
shift += 8
end
- when :big
+ when :big, :net
shift = ((length - 1) * 8)
mask = (0xff << shift)
length.times do |i|
buffer << ((self & mask) >> shift)