Bitwise arithmetic - Factor Documentation (original) (raw)
Bitwise arithmetic
Factor handbook » The language » Numbers » Arithmetic
Prev: | Modular arithmetic |
---|
There are two ways of looking at an integer -- as an abstract mathematical entity, or as a string of bits. The latter representation motivates bitwise operations. bitand ( x y -- z )
bitor ( x y -- z )
bitxor ( x y -- z )
bitnot ( x -- y )
shift ( x n -- y )
2/ ( x -- y )
2^ ( n -- 2^n )
bit? ( x n -- ? )
Advanced topics: Additional bitwise arithmetic
Integer virtual sequences
See also
Booleans