class Test
attr_accessor :param1
end
$ob = Test.new
$ob.param1 = "c";
#p $ob
#$file = File.open("object.dat", "wb")
#Marshal.dump($ob, $file)
#$file.close
$file = File.open("number.dat", "wb")
# 所有的整数数据都以0x040869开头,其中0x69是字符'i',也就是int的首字母
#Marshal.dump(0, $file) # 04 08 69 00
#Marshal.dump(1, $file) # 04 08 69 06, 1 = 0x06 - 0x05
#Marshal.dump(2, $file) # 04 08 69 07, 2 = 0x07 - 0x05
#Marshal.dump(120, $file) # 04 08 69 7D
#Marshal.dump(122, $file) # 04 08 69 7F, 122 = 0x7F - 0x05
#Marshal.dump(123, $file) # 04 08 69 01 7B, 123 = 0x7B
#Marshal.dump(124, $file) # 04 08 69 01 7C
#Marshal.dump(125, $file) # 04 08 69 01 7D
#Marshal.dump(255, $file) # 04 08 69 01 FF, 255 = 0xFF
#Marshal.dump(256, $file) # 04 08 69 02 00 01, 256 = 0x0100
#Marshal.dump(257, $file) # 04 08 69 02 01 01, 257 = 0x0101
#Marshal.dump(270, $file) # 04 08 69 02 0E 01, 270 = 0x010E
#Marshal.dump(0xABCD, $file) # 04 08 69 02 CD AB
#Marshal.dump(0xFFFF, $file) # 04 08 69 02 FF FF
#Marshal.dump(0x10000, $file) # 04 08 69 03 00 00 01
#Marshal.dump(0xABCDEF, $file) # 04 08 69 03 EF CD AB
#Marshal.dump(0xFFFFFF, $file) # 04 08 69 03 FF FF FF
#Marshal.dump(0x1000000, $file) # 04 08 69 04 00 00 00 01
#Marshal.dump(0x2000000, $file) # 04 08 69 04 00 00 00 02
#Marshal.dump(0xFFFFFFF, $file) # 04 08 69 04 FF FF FF 0F
#Marshal.dump(0x10000000, $file) # 04 08 69 04 00 00 00 10
#Marshal.dump(0x3FFFFFFF, $file) # 04 08 69 04 FF FF FF 3F
#Marshal.dump(-1, $file) # 04 08 69 FA
#Marshal.dump(-2, $file) # 04 08 69 F9
#Marshal.dump(-3, $file) # 04 08 69 F8
#Marshal.dump(-4, $file) # 04 08 69 F7
#Marshal.dump(-5, $file) # 04 08 69 F6
#Marshal.dump(-6, $file) # 04 08 69 F5
#Marshal.dump(-122, $file) # 04 08 69 81
#Marshal.dump(-123, $file) # 04 08 69 80
#Marshal.dump(-124, $file) # 04 08 69 FF 84
#Marshal.dump(-125, $file) # 04 08 69 FF 83
# 从0x40000000开始是long型,也就是1073741824
#Marshal.dump(0x40000000, $file) # 04 08 6C 2B 07 00 00 00 40
#Marshal.dump(0xFFFFFFFF, $file) # 04 08 6C 2B 07 FF FF FF FF
#Marshal.dump(0xABCDEF12, $file) # 04 08 6C(l) 2B(+) 07 12 EF CD AB
$file.close
exit
已经把正int整数型的结构研究完了,现在在研究负int整数型。