The bit-vector Module

<bit-vector> Open Primary Abstract Class
Superclasses

<vector>

Init-Keywords
  • size – Specifies the number of bits in the bit-vector. The default is 0.

Discussion

A compact representation of a vector of bits. The elements of the vector have the type <bit> and may be the values 0 and 1. The elements are indexed from 0 up to (size - 1).

<bit> Type
Equivalent

limited(<integer>, min: 0, max: 1)

Discussion

A subtype of <integer>, this is the type of elements of <bit-vector>. Objects of this type may have the value 0 or 1.

bit-count Function
Signature

bit-count vector #key bit-value => count

Parameters
Values
Discussion

Returns the number of bits in vector which are equal to bit-value. This may be a relatively slow operation.

bit-vector-and Function
Signature

bit-vector-and vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a new vector which is the bitwise and of the two argument vectors. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The size of the result will be no smaller than the minimum of the argument sizes, and no greater than the maximum of the argument sizes. The result-pad value is calculated by taking the logical and of the two input pad values.

bit-vector-and! Function
Signature

bit-vector-and! vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a vector which is the bitwise and of the two argument vectors. vector1 may or may not be modified by this operation. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The size of the result will be no smaller than the minimum of the argument sizes, and no greater than the maximum of the argument sizes. The result-pad value is calculated by taking the logical and of the two input pad values.

bit-vector-andc2 Function
Signature

bit-vector-andc2 vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a new vector which is the result of taking the bitwise and of vector1 and the bitwise not of vector2. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The size of the result will be no smaller than the minimum of the argument sizes, and no greater than the maximum of the argument sizes. The result-pad value is calculated by taking the logical and of pad1 with the complement of pad2.

bit-vector-andc2! Function
Signature

bit-vector-andc2! vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a vector which is the result of taking the bitwise and of vector1 and the bitwise not of vector2. vector1 may or may not be modified by this operation. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The size of the result will be no smaller than the minimum of the argument sizes, and no greater than the maximum of the argument sizes. The result-pad value is calculated by taking the logical and of pad1 with the complement of pad2.

bit-vector-not Function
Signature

bit-vector-not vector #key pad => result result-pad

Parameters
Values
Discussion

Returns a new vector which is the bitwise not of its argument.

bit-vector-not! Function
Signature

bit-vector-not! vector #key pad => result result-pad

Parameters
Values
Discussion

Modifies vector so that it becomes the bitwise not of its original contents. result == vector.

bit-vector-or Function
Signature

bit-vector-or vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a new vector which is the bitwise or of the two argument vectors. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The size of the result will be no smaller than the minimum of the argument sizes, and no greater than the maximum of the argument sizes. The result-pad value is calculated by taking the logical or of the two input pad values.

bit-vector-or! Function
Signature

bit-vector-or! vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a vector which is the bitwise or of the two argument vectors. vector1 may or may not be modified by this operation. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The size of the result will be no smaller than the minimum of the argument sizes and no greater than the maximum of the argument sizes. The result-pad value is calculated by taking the logical or of the two input pad values.

bit-vector-xor Function
Signature

bit-vector-xor vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a new vector which is the bitwise exclusive or of the two argument vectors. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result will be no smaller than the minimum of the argument sizes, and no greater than the maximum of the argument sizes. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The result-pad value is calculated by taking the logical xor of the two input pad values.

bit-vector-xor! Function
Signature

bit-vector-xor! vector1 vector2 #key pad1 pad2 => result pad

Parameters
Values
Discussion

Returns a vector which is the bitwise exclusive or of the two argument vectors. vector1 may or may not be modified by this operation. Each vector has an associated pad value. If the vectors are of different lengths, the shorter is considered extended with its pad value. The size of the result vector may be extended or shortened provided the bits added or dropped are the same as the result-pad value. The size of the result will be no smaller than the minimum of the argument sizes, and no greater than the maximum of the argument sizes. The result-pad value is calculated by taking the logical xor of the two input pad values.