Integer virtual sequences - Factor Documentation (original) (raw)
Integer virtual sequences
Factor handbook » The language » Numbers » Arithmetic » Bitwise arithmetic
Prev: | Additional bitwise arithmetic |
---|
The math.bits vocabulary implements words that represent a positive integer as a virtual sequence of bits in order of ascending significance, e.g. { f f f t } is 8. bits
( number length -- bits )
make-bits ( number -- bits )
bits>number ( seq -- number )
If you need binary digits instead of boolean, then you can use these:
( number length -- binary-bits )
make-binary-bits ( number -- binary-bits )