summaryrefslogtreecommitdiff
path: root/src/packedintarray.cpp
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2013-04-16 13:57:57 -0600
committerMike Buland <mike@xagasoft.com>2013-04-16 13:57:57 -0600
commit7bb55b03c393b5d00914d328a16d238d17f6aa0f (patch)
tree4d9a0547b105e1867f8118f2f00548e1e05589ad /src/packedintarray.cpp
parent25989c6d3911b1d29a5866e668bff52537893afb (diff)
downloadclic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.tar.gz
clic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.tar.bz2
clic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.tar.xz
clic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.zip
Added /, %, and = operators.
Division now works just fine, but by long division. There are apparently much faster ways of doing division, but as long as it works I feel like that's a great start :)
Diffstat (limited to 'src/packedintarray.cpp')
-rw-r--r--src/packedintarray.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/packedintarray.cpp b/src/packedintarray.cpp
index 7c54063..0e137bf 100644
--- a/src/packedintarray.cpp
+++ b/src/packedintarray.cpp
@@ -127,6 +127,26 @@ void PackedIntArray::set( const PackedIntArray &rSrc, int iStart, int iSize )
127 } 127 }
128} 128}
129 129
130void PackedIntArray::set( const PackedIntArray &rSrc )
131{
132 delete[] aData;
133
134 iBitWidth = rSrc.iBitWidth;
135 iCapacity = rSrc.iCapacity;
136 iCount = rSrc.iCount;
137 uMask = rSrc.uMask;
138
139 int iSize = StoreCount(iCapacity);
140 aData = new Store[iSize];
141 memcpy( aData, rSrc.aData, iSize*sizeof(Store) );
142}
143
144void PackedIntArray::trim()
145{
146 while( iCount > 0 && get( iCount-1 ) == 0 )
147 iCount--;
148}
149
130Bu::String PackedIntArray::toBitString() const 150Bu::String PackedIntArray::toBitString() const
131{ 151{
132 Bu::String sRet; 152 Bu::String sRet;