micropython/tests/basics/int_big_xor.py
Phil Howard dda9b9c6da all: Prune trailing whitespace.
Prune trailing whitespace across the whole project (almost), done
automatically with:

    grep -IUrl --color "[[:blank:]]$" --exclude-dir=.git --exclude=*.exp |\
        xargs sed -i 's/[[:space:]]*$//'

Exceptions:
- Skip third-party code in lib/ and drivers/cc3100/
- Skip generated code in bluetooth_init_cc2564C_1.5.c
- Preserve command output whitespace in docs, eg:
  docs/esp8266/tutorial/repl.rst

Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-03-07 16:25:17 +11:00

43 lines
732 B
Python

# test + +
print(0 ^ (1 << 80))
print((1 << 80) ^ (1 << 80))
print((1 << 80) ^ 0)
a = 0xfffffffffffffffffffffffffffff
print(a ^ (1 << 100))
print(a ^ (1 << 200))
print(a ^ a == 0)
print(bool(a ^ a))
# 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))
i = -1
print(i ^ 0xffffffffffffffff) # carry overflows to higher digit
# 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)))