Returns true if the n
th bit is high, false otherwise.
Returns true if the n
th bit is high, false otherwise.
if n >= size
Returns number of bits in this vector.
Returns a new bit vector with the n
th bit high if high
is true or low if high
is false.
Returns a bitwise AND of this vector with the specified vector.
Returns a bitwise AND of this vector with the specified vector.
The resulting vector's size is the minimum of this vector's size and the specified vector's size.
Returns a new bit vector representing this vector's contents followed by the specified vector's contents.
Returns a bit vector of the same size with each bit shifted to the left n
bits.
Returns a bit vector of the same size with each bit shifted to the right n
bits where the n
left-most bits are sign extended.
Returns a bit vector of the same size with each bit shifted to the right n
bits where the n
left-most bits are low.
Returns a bitwise XOR of this vector with the specified vector.
Returns a bitwise XOR of this vector with the specified vector.
The resulting vector's size is the minimum of this vector's size and the specified vector's size.
Returns a vector whose contents are the results of taking the first n
bits of this vector.
Returns a vector whose contents are the results of taking the first n
bits of this vector.
If this vector does not contain at least n
bits, an error message is returned.
take
Returns a bitwise AND of this vector with the specified vector.
Returns a bitwise AND of this vector with the specified vector.
The resulting vector's size is the minimum of this vector's size and the specified vector's size.
Alias for get
.
Alias for get
.
get(Long)
Returns a new bit vector with the n
th bit low (and all other bits unmodified).
Return a BitVector
with the same contents as this
, but
based off a single ByteVector
.
Return a BitVector
with the same contents as this
, but
based off a single ByteVector
.
This may involve copying data to a fresh ByteVector
, but
has the advantage that lookups index directly into a single
ByteVector
rather than traversing a logarithmic number of nodes
in this tree.
Consumes the first n
bits of this vector and decodes them with the specified function,
resulting in a vector of the remaining bits and the decoded value.
Consumes the first n
bits of this vector and decodes them with the specified function,
resulting in a vector of the remaining bits and the decoded value. If this vector
does not have n
bits or an error occurs while decoding, an error is returned instead.
Returns a vector whose contents are the results of skipping the first n
bits of this vector and taking the rest.
Returns a vector whose contents are the results of skipping the first n
bits of this vector and taking the rest.
The resulting vector's size is 0 max (size - n)
Returns a vector whose contents are the results of skipping the last n
bits of this vector.
Returns a vector whose contents are the results of skipping the last n
bits of this vector.
The resulting vector's size is 0 max (size - n)
Forces any Suspend
nodes in this BitVector
and ensures the tree is balanced.
Computed by sampling bits Stream.iterate(0L)(n => (n*1.7).toLong + 1)
,
up until the maximum index.
Computed by sampling bits Stream.iterate(0L)(n => (n*1.7).toLong + 1)
,
up until the maximum index. The result is cached.
Returns the first bit in this vector.
Returns the first bit in this vector.
if this vector is empty
Returns the number of bits in this vector, or None
if the size does not
fit into an Int
.
Returns true if this bit vector has no bits.
Returns a bit vector of the same size with each bit shifted to the left n
bits.
Returns Some(true)
if the n
th bit is high, Some(false)
if low, and None
if n >= size
.
Returns true if this bit vector has a non-zero number of bits.
Returns a bitwise complement of this vector.
Returns a bitwise OR of this vector with the specified vector.
Returns a bitwise OR of this vector with the specified vector.
The resulting vector's size is the minimum of this vector's size and the specified vector's size.
Returns an n
-bit vector whose contents are this vector's contents followed by 0 or more low bits.
Returns an n
-bit vector whose contents are this vector's contents followed by 0 or more low bits.
if n < size
Reverse the bits of this vector.
Returns a new vector of the same size with the byte order reversed.
Returns a bit vector of the same size with each bit shifted to the right n
bits.
Returns a bit vector of the same size with each bit shifted to the right n
bits.
whether the n
left-most bits should take on the value of bit 0
Returns a new bit vector with the n
th bit high (and all other bits unmodified).
Returns true
if the size of this BitVector
is greater than n
.
Returns true
if the size of this BitVector
is greater than n
. Unlike size
, this
forces this BitVector
from left to right, halting as soon as it has a definite answer.
Returns true
if the size of this BitVector
is less than n
.
Returns true
if the size of this BitVector
is less than n
. Unlike size
, this
forces this BitVector
from left to right, halting as soon as it has a definite answer.
Returns a vector whose contents are the results of taking the first n
bits of this vector.
Returns a vector whose contents are the results of taking the first n
bits of this vector.
The resulting vector's size is n min size
.
Note: if an n
-bit vector is required, use the acquire
method instead.
acquire
Returns a vector whose contents are the results of taking the last n
bits of this vector.
Returns a vector whose contents are the results of taking the last n
bits of this vector.
The resulting vector's size is n min size
.
Note: if an n
-bit vector is required, use the acquire
method instead.
acquire
Converts the contents of this bit vector to a binary string of size
digits.
Converts the contents of this vector to a byte array.
Converts the contents of this vector to a byte array.
If this vector's size does not divide evenly by 8, the last byte of the returned vector will be zero-padded to the right.
Converts the contents of this vector to a java.nio.ByteBuffer
.
Converts the contents of this vector to a java.nio.ByteBuffer
.
The returned buffer is freshly allocated with limit set to the minimum number of bytes needed to represent the contents of this vector, position set to zero, and remaining set to the limit.
toByteVector
Converts the contents of this vector to a byte vector.
Converts the contents of this vector to a byte vector.
If this vector's size does not divide evenly by 8, the last byte of the returned vector will be zero-padded to the right.
Converts the contents of this bit vector to a hexadecimal string of ceil(size / 4)
nibbles.
Converts the contents of this bit vector to a hexadecimal string of ceil(size / 4)
nibbles.
The last nibble is right-padded with zeros if the size is not evenly divisible by 4.
Return the sequence of bits in this vector.
Return the sequence of bits in this vector. The returned
IndexedSeq
is just a view; nothing is actually copied.
if this vector's size exceeds Int.MaxValue
toIndexedSeq
acquire
Display the size and bytes of this BitVector
.
Display the size and bytes of this BitVector
.
For bit vectors beyond a certain size, only a hash of the
contents are shown.
Returns a bitwise complement of this vector.
Returns a bitwise XOR of this vector with the specified vector.
Returns a bitwise XOR of this vector with the specified vector.
The resulting vector's size is the minimum of this vector's size and the specified vector's size.
Returns a bitwise OR of this vector with the specified vector.
Returns a bitwise OR of this vector with the specified vector.
The resulting vector's size is the minimum of this vector's size and the specified vector's size.
Persistent vector of bits, stored as bytes.
Bits are numbered left to right, starting at 0.