diff --git a/lib/bit-struct/unsigned-field.rb b/lib/bit-struct/unsigned-field.rb index 34be578598..3b79c52f0b 100644 --- a/lib/bit-struct/unsigned-field.rb +++ b/lib/bit-struct/unsigned-field.rb @@ -39,8 +39,8 @@ class BitStruct if length_byte == 1 rest = 8 - length_bit - mask = ["0"*offset_bit + "1"*length + "0"*rest].pack("B8")[0].ord - mask2 = ["1"*offset_bit + "0"*length + "1"*rest].pack("B8")[0].ord + mask = ["0"*offset_bit + "1"*length + "0"*rest].pack("B8")[0,1].unpack('C')[0] + mask2 = ["1"*offset_bit + "0"*length + "1"*rest].pack("B8")[0,1].unpack('C')[0] cl.class_eval do if divisor