The bitvector Module¶

<bitvector>
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<bitvector>
. Objects of this type may have the value0
or1
.

bitcount
Function¶  Signature
bitcount vector #key bitvalue => count
 Parameters
vector – An instance of
<bitvector>
.bitvalue (#key) – An instance of
<bit>
.
 Values
count – An instance of
<integer>
.
 Discussion
Returns the number of bits in
vector
which are equal tobitvalue
. This may be a relatively slow operation.

bitvectorand
Function¶  Signature
bitvectorand vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad 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 resultpad value is calculated by taking the logical and of the two input pad values.

bitvectorand!
Function¶  Signature
bitvectorand! vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad 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 resultpad value is calculated by taking the logical and of the two input pad values.

bitvectorandc2
Function¶  Signature
bitvectorandc2 vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad 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 resultpad value is calculated by taking the logical and ofpad1
with the complement ofpad2
.

bitvectorandc2!
Function¶  Signature
bitvectorandc2! vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad 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 resultpad value is calculated by taking the logical and ofpad1
with the complement ofpad2
.

bitvectornot
Function¶  Signature
bitvectornot vector #key pad => result resultpad
 Parameters
vector – An instance of
<bitvector>
.pad (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.resultpad – An instance of
<bit>
.
 Discussion
Returns a new vector which is the bitwise not of its argument.

bitvectornot!
Function¶  Signature
bitvectornot! vector #key pad => result resultpad
 Parameters
vector – An instance of
<bitvector>
.pad (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.resultpad – An instance of
<bit>
.
 Discussion
Modifies
vector
so that it becomes the bitwise not of its original contents.result == vector
.

bitvectoror
Function¶  Signature
bitvectoror vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad 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 resultpad value is calculated by taking the logical or of the two input pad values.

bitvectoror!
Function¶  Signature
bitvectoror! vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad 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 resultpad value is calculated by taking the logical or of the two input pad values.

bitvectorxor
Function¶  Signature
bitvectorxor vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad value. The resultpad value is calculated by taking the logical xor of the two input pad values.

bitvectorxor!
Function¶  Signature
bitvectorxor! vector1 vector2 #key pad1 pad2 => result pad
 Parameters
vector1 – An instance of
<bitvector>
.vector2 – An instance of
<bitvector>
.pad1 (#key) – An instance of
<bit>
.pad2 (#key) – An instance of
<bit>
.
 Values
result – An instance of
<bitvector>
.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 resultpad 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 resultpad value is calculated by taking the logical xor of the two input pad values.