21 fNBits(nBits>0 ? nBits : 0),
22 fNBytes(fNBits ? ((fNBits - 1) / 8) + 1 : 1),
23 fAllBits(new unsigned char[fNBytes])
33 fNBits(original.fNBits),
34 fNBytes(original.fNBytes),
35 fAllBits(new unsigned char[fNBytes])
49 if (
this == &rhs) {
return *
this; }
91 needed > 0 &&
fAllBits[needed] == 0;)
99 unsigned char* old_location =
fAllBits;
100 fAllBits =
new unsigned char[needed];
102 std::memcpy(fAllBits, old_location, needed);
103 delete [] old_location;
358 for (
unsigned int i = 0; i <
fNBytes; ++i)
360 unsigned char val =
fAllBits[fNBytes - 1 - i];
361 for (
unsigned int j = 0; j < 8; ++j)
363 os << (bool)(val & 0x80);
374 for (
unsigned int i = 0; i <
fNBytes; ++i)
377 for (
unsigned int j = 0; j < 8; ++j)
379 if (val & 1) printf(
" bit:%4d = 1\n", count);
400 unsigned char* newBits =
new unsigned char[nbytes];
411 unsigned int nbytes = (nBits + 7) >> 3;
416 std::memcpy(
fAllBits, array, nbytes);
434 Set(nBits, (
const char*)array);
void Output(std::ostream &) const
UBits & operator=(const UBits &rhs)
void ResetAllBits(bool value=false)
void Set(unsigned int nbits, const char *array)
UBits(unsigned int nbits=0)
void ReserveBytes(unsigned int nbytes)
void Get(char *array) const