toggle-bit ( m n -- m' )
Factor handbook » The language » Numbers » Arithmetic » Bitwise arithmetic » Additional bitwise arithmetic

Prev:bits ( m n -- m' )
Next:mask ( x n -- y )


Vocabulary
math.bitwise

Inputs
man integer
nan integer


Outputs
m'an integer


Word description
Toggles the nth bit of an integer.

Examples
USING: math.bitwise kernel prettyprint ; 0 3 toggle-bit .b
0b1000

USING: math.bitwise kernel prettyprint ; 0b1000 3 toggle-bit .b
0b0


Definition