You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
544 B
20 lines
544 B
8 years ago
|
# tests int constant folding in compiler
|
||
|
|
||
|
# negation
|
||
|
print(-0x3fffffff) # 32-bit edge case
|
||
|
print(-0x3fffffffffffffff) # 64-bit edge case
|
||
|
print(-(-0x3fffffff - 1)) # 32-bit edge case
|
||
|
print(-(-0x3fffffffffffffff - 1)) # 64-bit edge case
|
||
|
|
||
|
# 1's complement
|
||
|
print(~0x3fffffff) # 32-bit edge case
|
||
|
print(~0x3fffffffffffffff) # 64-bit edge case
|
||
|
print(~(-0x3fffffff - 1)) # 32-bit edge case
|
||
|
print(~(-0x3fffffffffffffff - 1)) # 64-bit edge case
|
||
|
|
||
|
# zero big-num on rhs
|
||
|
print(1 + ((1 << 65) - (1 << 65)))
|
||
|
|
||
|
# negative big-num on rhs
|
||
|
print(1 + (-(1 << 65)))
|