From 0befcc026be9e4f6c40f8771c7f26f767ebddbf7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 30 Sep 2024 11:50:17 -0700 Subject: Erasing streams works, stream map building works. --- src/unstable/bitstring.cpp | 12 ++++++++++-- src/unstable/bitstring.h | 10 ++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/unstable') diff --git a/src/unstable/bitstring.cpp b/src/unstable/bitstring.cpp index 21c1316..b80c073 100644 --- a/src/unstable/bitstring.cpp +++ b/src/unstable/bitstring.cpp @@ -209,7 +209,7 @@ void Bu::BitString::flipBit( long iBit ) caData[iBit/8] ^= (1<<(iBit%8)); } -bool Bu::BitString::getBit( long iBit ) +bool Bu::BitString::getBit( long iBit ) const { if( iBit >= iBits || iBit < 0 ) return false; if( (caData[iBit/8] & (1<<(iBit%8))) == 0 ) @@ -224,7 +224,7 @@ long Bu::BitString::getBitLength() return iBits; } -long Bu::BitString::getSize() +long Bu::BitString::getSize() const { return iBits; } @@ -311,6 +311,14 @@ void Bu::BitString::clear() } } +void Bu::BitString::fill() +{ + if( caData != NULL ) + { + memset( caData, 0xff, iBytes ); + } +} + bool Bu::BitString::setBitLength( long iLength, bool bClear ) { return setSize( iLength, bClear ); diff --git a/src/unstable/bitstring.h b/src/unstable/bitstring.h index afc22fb..70ba822 100644 --- a/src/unstable/bitstring.h +++ b/src/unstable/bitstring.h @@ -88,7 +88,7 @@ namespace Bu *@param iBit The index of the bit to test. *@returns True for a 1, false for a 0. */ - bool getBit( long iBit ); + bool getBit( long iBit ) const; /** * Inverts the entire BitString, in effect this calls flipBit on every @@ -106,7 +106,7 @@ namespace Bu DEPRECATED long getBitLength(); - long getSize(); + long getSize() const; /** * Sets the entire BitString to zeros, but it does it very quickly. @@ -114,6 +114,12 @@ namespace Bu */ void clear(); + /** + * Sets the entire BitString to ones, but it does it very quickly. + * This operation runs in O(N). + */ + void fill(); + /** * Gets another BitString that is autonomous of the current one * (contains a copy of the memory, not a pointer) and contains a subset -- cgit v1.2.3