Handbook
Glossary
on-bits ( m -- n )
Factor handbook
»
The language
»
Numbers
»
Arithmetic
»
Bitwise arithmetic
»
Additional bitwise arithmetic
Prev:
unmask? ( x n -- ? )
Next:
bit-count ( obj -- n )
Vocabulary
math
.
bitwise
Inputs
m
an
integer
Outputs
n
an
integer
Word description
Returns an integer with
m
bits set.
Examples
USING: math.bitwise kernel prettyprint ; 6 on-bits .h
0x3f
USING: math.bitwise kernel prettyprint ; 64 on-bits .h
0xffffffffffffffff
Definition
USING:
kernel
math
;
IN:
math.bitwise
:
on-bits
( m -- n )
dup
0
<=
[
drop
0
]
[
2^
1
-
]
if
;
inline