The bit-vector Module¶
- <bit-vector> Open Primary Abstract Class¶
- <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 value0
or1
.
- bit-count Function¶
- Signature:
bit-count vector #key bit-value => count
- Parameters:
vector – An instance of
<bit-vector>
.bit-value (#key) – An instance of
<bit>
.
- Values:
count – An instance of
<integer>
.
- Discussion:
Returns the number of bits in
vector
which are equal tobit-value
. This may be a relatively slow operation.
- bit-vector-and Function¶
- Signature:
bit-vector-and vector1 vector2 #key pad1 pad2 => result pad
- Parameters:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- 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:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- 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:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- Discussion:
Returns a new vector which is the result of taking the bitwise and of
vector1
and the bitwise not ofvector2
. 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 ofpad1
with the complement ofpad2
.
- bit-vector-andc2! Function¶
- Signature:
bit-vector-andc2! vector1 vector2 #key pad1 pad2 => result pad
- Parameters:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- Discussion:
Returns a vector which is the result of taking the bitwise and of
vector1
and the bitwise not ofvector2
.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 ofpad1
with the complement ofpad2
.
- bit-vector-not Function¶
- Signature:
bit-vector-not vector #key pad => result result-pad
- Parameters:
vector – An instance of
<bit-vector>
.pad (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.result-pad – An instance of
<bit>
.
- 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:
vector – An instance of
<bit-vector>
.pad (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.result-pad – An instance of
<bit>
.
- 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:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- 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:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- 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:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- 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:
vector1 – An instance of
<bit-vector>
.vector2 – An instance of
<bit-vector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
- Values:
result – An instance of
<bit-vector>
.pad – An instance of
<bit>
.
- 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.