Warning:This is the manual of the legacy Guile2.0series. You may want to read the manual of the current stable series instead.

Next: rnrs syntax-case, Previous: rnrs arithmetic flonums, Up: R6RS Standard Libraries [Contents][Index]

The `(rnrs arithmetic bitwise (6))`

library provides procedures for
performing bitwise arithmetic operations on the two’s complement
representations of fixnums.

This library and the procedures it exports share functionality with SRFI-60, which provides support for bitwise manipulation of integers (see SRFI-60).

- Scheme Procedure:
**bitwise-not***ei* - Scheme Procedure:
**bitwise-and***ei1 ...* - Scheme Procedure:
**bitwise-ior***ei1 ...* - Scheme Procedure:
**bitwise-xor***ei1 ...* These procedures are identical to the

`lognot`

,`logand`

,`logior`

, and`logxor`

procedures provided by Guile’s core library. See Bitwise Operations, for documentation.

- Scheme Procedure:
**bitwise-if***ei1 ei2 ei3* Returns the bitwise “if” of its arguments. The bit at position

`i`

in the return value will be the`i`

th bit from`ei2`if the`i`

th bit of`ei1`is 1, the`i`

th bit from`ei3`.

- Scheme Procedure:
**bitwise-bit-count***ei* Returns the number of 1 bits in the two’s complement representation of

`ei`.

- Scheme Procedure:
**bitwise-length***ei* Returns the number of bits necessary to represent

`ei`.

- Scheme Procedure:
**bitwise-first-bit-set***ei* Returns the index of the least significant 1 bit in the two’s complement representation of

`ei`.

- Scheme Procedure:
**bitwise-bit-set?***ei1 ei2* Returns

`#t`

if the`ei2`th bit in the two’s complement representation of`ei1`is 1,`#f`

otherwise.

- Scheme Procedure:
**bitwise-copy-bit***ei1 ei2 ei3* Returns the result of setting the

`ei2`th bit of`ei1`to the`ei2`th bit of`ei3`.

- Scheme Procedure:
**bitwise-bit-field***ei1 ei2 ei3* Returns the integer representation of the contiguous sequence of bits in

`ei1`that starts at position`ei2`(inclusive) and ends at position`ei3`(exclusive).

- Scheme Procedure:
**bitwise-copy-bit-field***ei1 ei2 ei3 ei4* Returns the result of replacing the bit field in

`ei1`with start and end positions`ei2`and`ei3`with the corresponding bit field from`ei4`.

- Scheme Procedure:
**bitwise-arithmetic-shift***ei1 ei2* - Scheme Procedure:
**bitwise-arithmetic-shift-left***ei1 ei2* - Scheme Procedure:
**bitwise-arithmetic-shift-right***ei1 ei2* Returns the result of shifting the bits of

`ei1`right or left by the`ei2`positions.`bitwise-arithmetic-shift`

is identical to`bitwise-arithmetic-shift-left`

.

- Scheme Procedure:
**bitwise-rotate-bit-field***ei1 ei2 ei3 ei4* Returns the result of cyclically permuting the bit field in

`ei1`with start and end positions`ei2`and`ei3`by`ei4`bits in the direction of more significant bits.

- Scheme Procedure:
**bitwise-reverse-bit-field***ei1 ei2 ei3* Returns the result of reversing the order of the bits of

`ei1`between position`ei2`(inclusive) and position`ei3`(exclusive).