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

Prev:odd-parity? ( obj -- ? )
Next:bitroll ( x s w -- y )


Vocabulary
math.bitwise

Inputs
man integer
nan integer


Outputs
m'an integer


Word description
Wraps an integer m by modding it by n. This word is uses bitwise arithmetic and does not actually call the modulus word, and as such can only mod by powers of two.

Examples
Equivalent to modding by 8:
USING: math.bitwise prettyprint ; 0xffff 8 wrap .h
0x7


Definition