2014-01-31 10:13:51 -05:00
|
|
|
# This tests small int range for 32-bit machine
|
2014-01-12 10:06:25 -05:00
|
|
|
|
|
|
|
a = 0x3fffff
|
|
|
|
print(a)
|
|
|
|
a *= 0x10
|
|
|
|
print(a)
|
|
|
|
a *= 0x10
|
|
|
|
print(a)
|
|
|
|
a += 0xff
|
|
|
|
print(a)
|
|
|
|
# This would overflow
|
|
|
|
#a += 1
|
|
|
|
|
|
|
|
a = -0x3fffff
|
|
|
|
print(a)
|
|
|
|
a *= 0x10
|
|
|
|
print(a)
|
|
|
|
a *= 0x10
|
|
|
|
print(a)
|
|
|
|
a -= 0xff
|
|
|
|
print(a)
|
|
|
|
# This still doesn't overflow
|
|
|
|
a -= 1
|
|
|
|
print(a)
|
|
|
|
# This would overflow
|
|
|
|
#a -= 1
|