54 int size()
const {
return data.size(); }
56 short bit(
unsigned int a)
const {
return (
data[a]); }
58 short bit(
unsigned int a,
short val)
60 return (
data[a] = (val != 0 ? 1 : 0));
73 return (std::memcmp(&
data[lhsIdx], &rhs.
data[rhsIdx], l) != 0 ?
false :
true);
84 void copy(
const GABinaryString &orig,
unsigned int destIdx,
unsigned int origIdx,
unsigned int l)
87 std::memcpy(&
data[destIdx], &orig.
data[origIdx], l);
98 void move(
unsigned int destIdx,
unsigned int sourceIdx,
unsigned int l)
100 std::memmove(&
data[destIdx], &
data[sourceIdx], l);
103 void set(
unsigned int a,
unsigned int l)
105 for (
unsigned int i = a; i < l; i++)
111 void unset(
unsigned int a,
unsigned int l)
113 for (
unsigned int i = a; i < l; i++)
119 void randomize(
unsigned int a,
unsigned int l)
121 for (
unsigned int i = 0; i < l; i++)
123 data[i + a] =
static_cast<GABit
>(GARandomBit());
129 for (
auto &item :
data)
131 item =
static_cast<GABit
>(GARandomBit());
This header defines the interface for the binary string.
Definition: GABinStr.hpp:24
int resize(unsigned int x)
Resize the bitstream to the specified number of bits.
Definition: GABinStr.hpp:48
std::vector< GABit > data
the data themselves
Definition: GABinStr.hpp:137
void copy(const GABinaryString &orig, unsigned int destIdx, unsigned int origIdx, unsigned int l)
Definition: GABinStr.hpp:84
void copy(const GABinaryString &orig)
Copy the contents of the bitstream.
Definition: GABinStr.hpp:35
bool equal(const GABinaryString &rhs, unsigned int lhsIdx, unsigned int rhsIdx, unsigned int l) const
Are two (subset) bitstreams equal?
Definition: GABinStr.hpp:71
void move(unsigned int destIdx, unsigned int sourceIdx, unsigned int l)
Copy (sub) bitstream.
Definition: GABinStr.hpp:98