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

Next:bitor ( x y -- z )


Vocabulary
math

Inputs
xan integer
yan integer


Outputs
zan integer


Word description
Outputs a new integer where each bit is set if and only if the corresponding bit is set in both inputs.

Examples
USING: math prettyprint ; 0b101 0b10 bitand .b
0b0

USING: math prettyprint ; 0b110 0b10 bitand .b
0b10


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

Definition


Methods