I'm trying to figure out how numbers are interpreted inside scripts. Could someone check if the following test cases are correct?
"bytes" is only the data part, I'm skipping the size part which would be 0x01, 0x02 and 0x03 for 1, 2 and 3 byte data respectively.
Integer --- bytes
17 { 17 }
75 { 75 }
76 { 76 }
127 { 127 }
128 { 128, 0 }
129 { 129, 0 }
255 { 255, 0 }
256 { 0, 1 }
32767 { 255, 127 } // 32767 = 0xff7f = 0b11111111 01111111
32768 { 0, 128, 0 } // 32768 = 0x0080 = 0b00000000 10000000
32769 { 1, 128, 0 } // 32769 = 0x0080 = 0b00000001 10000000
65535 { 255, 255, 0 } // 65535 = 0xffff
-2 { 0b10000010 } // 0b10000010 = 0x82 = 130
-127 { 0b11111111 } // 0b11111111 = 0xff = 255
-128 { 128, 128 } // 128 = 0b10000000
-129 { 129, 128 } // 128 = 0b10000000