@ -113,17 +113,17 @@ public:
if ( initTrue ) {
if ( initTrue ) {
/ / Finally , create the full bucket array .
/ / Finally , create the full bucket array .
bucketArray = new uint64_t [ bucketCount ] ;
this - > bucketArray = new uint64_t [ bucketCount ] ;
/ / Now initialize the values .
/ / Now initialize the values .
for ( uint_fast64_t i = 0 ; i < bucketCount ; + + i ) {
for ( uint_fast64_t i = 0 ; i < bucketCount ; + + i ) {
bucketArray [ i ] = - 1ll ;
this - > bucketArray [ i ] = - 1ll ;
}
}
truncateLastBucket ( ) ;
truncateLastBucket ( ) ;
} else {
} else {
/ / Finally , create the full bucket array .
/ / Finally , create the full bucket array .
bucketArray = new uint64_t [ bucketCount ] ( ) ;
this - > bucketArray = new uint64_t [ bucketCount ] ( ) ;
}
}
}
}
@ -135,7 +135,7 @@ public:
BitVector ( const BitVector & bv ) : bucketCount ( bv . bucketCount ) , bitCount ( bv . bitCount ) , endIterator ( * this , bitCount , bitCount , false ) {
BitVector ( const BitVector & bv ) : bucketCount ( bv . bucketCount ) , bitCount ( bv . bitCount ) , endIterator ( * this , bitCount , bitCount , false ) {
LOG4CPLUS_WARN ( logger , " Invoking copy constructor. " ) ;
LOG4CPLUS_WARN ( logger , " Invoking copy constructor. " ) ;
bucketArray = new uint64_t [ bucketCount ] ;
bucketArray = new uint64_t [ bucketCount ] ;
std : : copy ( bv . bucketArray , bv . bucketArray + bucketCount , bucketArray ) ;
std : : copy ( bv . bucketArray , bv . bucketArray + this - > bucketCount , this - > bucketArray ) ;
}
}
/ / ! Destructor
/ / ! Destructor
@ -143,8 +143,8 @@ public:
* Destructor . Frees the underlying bucket array .
* Destructor . Frees the underlying bucket array .
*/
*/
~ BitVector ( ) {
~ BitVector ( ) {
if ( bucketArray ! = nullptr ) {
delete [ ] bucketArray ;
if ( this - > bucketArray ! = nullptr ) {
delete [ ] this - > bucketArray ;
}
}
}
}
@ -179,7 +179,7 @@ public:
}
}
/ / Reserve a temporary array for copying .
/ / Reserve a temporary array for copying .
uint_fast 64_t * tempArray = new uint_fas t64_t [ newBucketCount ] ;
uint64_t * tempArray = new uint64_t [ newBucketCount ] ;
/ / Copy over the elements from the old bit vector .
/ / Copy over the elements from the old bit vector .
uint_fast64_t copySize = ( newBucketCount < = bucketCount ) ? newBucketCount : bucketCount ;
uint_fast64_t copySize = ( newBucketCount < = bucketCount ) ? newBucketCount : bucketCount ;
@ -506,9 +506,9 @@ private:
* from ( bitCount + 1 ) .
* from ( bitCount + 1 ) .
*/
*/
void truncateLastBucket ( ) {
void truncateLastBucket ( ) {
if ( ( bitCount & mod64mask ) ! = 0 ) {
uint64_t mask = ( ( 1ll < < ( bitCount & mod64mask ) ) - 1ll ) ;
bucketArray [ bucketCount - 1 ] = bucketArray [ bucketCount - 1 ] & mask ;
if ( ( this - > bitCount & mod64mask ) ! = 0 ) {
uint64_t mask = ( ( 1ll < < ( this - > bitCount & mod64mask ) ) - 1ll ) ;
this - > bucketArray [ this - > bucketCount - 1 ] = this - > bucketArray [ this - > bucketCount - 1 ] & mask ;
}
}
}
}