bitnot ( x -- y )
Factor handbook » The language » Numbers » Arithmetic » Bitwise arithmetic

Prev:bitxor ( x y -- z )
Next:shift ( x n -- y )


Vocabulary
math

Inputs
xan integer


Outputs
yan integer


Word description
Computes the bitwise complement of the input; that is, each bit in the input number is flipped.

Notes
This word implements bitwise not, so applying it to booleans will throw an error. Boolean not is the not word.

Due to the two's complement representation of signed integers, the following two lines are equivalent:
bitnot neg 1 -


Definition


Methods