chickadee » chicken » bitwise

Module (chicken bitwise)

Binary integer operations are provided by the (chicken bitwise) module.

Binary integer operations

bitwise-and N1 ...procedure
bitwise-ior N1 ...procedure
bitwise-xor N1 ...procedure
bitwise-not Nprocedure
arithmetic-shift N1 N2procedure

Binary integer operations. arithmetic-shift shifts the argument N1 by N2 bits to the left. If N2 is negative, then N1 is shifted to the right. These operations only accept exact integers.


bit->boolean N INDEXprocedure

Returns #t if the bit at the position INDEX in the integer N is set, or #f otherwise. The rightmost/least-significant bit is bit 0.


integer-length Nprocedure

Returns the number of bits needed to represent the exact integer N in 2's complement notation.

Previous: Module (chicken base)

Next: Module (chicken blob)

Contents »