Handbook
Glossary
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
m
an
integer
n
an
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
USING:
math
;
IN:
math.bitwise
:
wrap
( m n -- m' )
1
-
bitand
;
inline