summaryrefslogtreecommitdiff
path: root/src/packedintarray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/packedintarray.cpp')
-rw-r--r--src/packedintarray.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/packedintarray.cpp b/src/packedintarray.cpp
index b91358e..824f589 100644
--- a/src/packedintarray.cpp
+++ b/src/packedintarray.cpp
@@ -4,7 +4,7 @@
4 4
5#define bitsizeof( x ) ((sizeof(x))*8) 5#define bitsizeof( x ) ((sizeof(x))*8)
6#define StoreBits ((bitsizeof(PackedIntArray::Store))) 6#define StoreBits ((bitsizeof(PackedIntArray::Store)))
7#define StoreCount( x ) (((x*iBitWidth)/StoreBits)+(((x*iBitWidth)%StoreBits)?1:0)) 7#define StoreCount( x ) ((((x)*iBitWidth)/StoreBits)+((((x)*iBitWidth)%StoreBits)?1:0))
8 8
9PackedIntArray::PackedIntArray( PackedIntArray::Unit iBitWidth ) : 9PackedIntArray::PackedIntArray( PackedIntArray::Unit iBitWidth ) :
10 iBitWidth( iBitWidth ), 10 iBitWidth( iBitWidth ),
@@ -207,10 +207,11 @@ void PackedIntArray::checkCapacity()
207 { 207 {
208// Bu::println("!!! Resizing !!!"); 208// Bu::println("!!! Resizing !!!");
209 Store *aOldData = aData; 209 Store *aOldData = aData;
210 int iSize = StoreCount(iCapacity);
210 int iNewSize = (iCapacity==0)?(bitsizeof(Store)/iBitWidth):(iCapacity=StoreCount(iCapacity*2)); 211 int iNewSize = (iCapacity==0)?(bitsizeof(Store)/iBitWidth):(iCapacity=StoreCount(iCapacity*2));
211 while( iNewSize < iCount ) 212 int iCountSize = StoreCount(iCount);
213 while( iNewSize < iCountSize )
212 iNewSize *= 2; 214 iNewSize *= 2;
213 int iSize = StoreCount(iCapacity);
214// Bu::println(" %1 => %2 (%3 bit words)").arg( iSize ).arg( iNewSize ) 215// Bu::println(" %1 => %2 (%3 bit words)").arg( iSize ).arg( iNewSize )
215// .arg( StoreBits ); 216// .arg( StoreBits );
216 aData = new Store[iNewSize]; 217 aData = new Store[iNewSize];