2016-01-31 03:35:58 +00:00
|
|
|
# test + +
|
|
|
|
|
2015-03-14 21:20:58 +00:00
|
|
|
print(0 ^ (1 << 80))
|
|
|
|
print((1 << 80) ^ (1 << 80))
|
|
|
|
print((1 << 80) ^ 0)
|
|
|
|
|
|
|
|
a = 0xfffffffffffffffffffffffffffff
|
|
|
|
print(a ^ (1 << 100))
|
|
|
|
print(a ^ (1 << 200))
|
2015-11-22 20:02:15 +00:00
|
|
|
print(a ^ a == 0)
|
2015-11-22 20:11:01 +00:00
|
|
|
print(bool(a ^ a))
|
2016-01-31 03:35:58 +00:00
|
|
|
|
|
|
|
# test - +
|
|
|
|
|
|
|
|
print((-1 << 80) ^ (1 << 80))
|
|
|
|
print((-1 << 80) ^ 0)
|
|
|
|
|
|
|
|
print((-a) ^ (1 << 100))
|
|
|
|
print((-a) ^ (1 << 200))
|
|
|
|
print((-a) ^ a == 0)
|
|
|
|
print(bool((-a) ^ a))
|
2018-04-04 03:57:22 +00:00
|
|
|
i = -1
|
|
|
|
print(i ^ 0xffffffffffffffff) # carry overflows to higher digit
|
2016-01-31 03:35:58 +00:00
|
|
|
|
|
|
|
# test + -
|
|
|
|
|
|
|
|
print(0 ^ (-1 << 80))
|
|
|
|
print((1 << 80) ^ (-1 << 80))
|
|
|
|
|
|
|
|
print(a ^ (-1 << 100))
|
|
|
|
print(a ^ (-1 << 200))
|
|
|
|
print(a ^ (-a) == 0)
|
|
|
|
print(bool(a ^ (-a)))
|
|
|
|
|
|
|
|
# test - -
|
|
|
|
|
|
|
|
print((-1 << 80) ^ (-1 << 80))
|
|
|
|
|
|
|
|
print((-a) ^ (-1 << 100))
|
|
|
|
print((-a) ^ (-1 << 200))
|
|
|
|
print((-a) ^ (-a) == 0)
|
|
|
|
print(bool((-a) ^ (-a)))
|