Handbook
Glossary
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
m
an
integer
n
an
integer
Outputs
m'
an
integer
Word description
Toggles the
n
th 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
USING:
math
;
IN:
math.bitwise
:
toggle-bit
( m n -- m' )
2^
bitxor
;
inline