From 7bb55b03c393b5d00914d328a16d238d17f6aa0f Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 16 Apr 2013 13:57:57 -0600 Subject: 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 :) --- src/packedintarray.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/packedintarray.cpp') 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 ) } } +void PackedIntArray::set( const PackedIntArray &rSrc ) +{ + delete[] aData; + + iBitWidth = rSrc.iBitWidth; + iCapacity = rSrc.iCapacity; + iCount = rSrc.iCount; + uMask = rSrc.uMask; + + int iSize = StoreCount(iCapacity); + aData = new Store[iSize]; + memcpy( aData, rSrc.aData, iSize*sizeof(Store) ); +} + +void PackedIntArray::trim() +{ + while( iCount > 0 && get( iCount-1 ) == 0 ) + iCount--; +} + Bu::String PackedIntArray::toBitString() const { Bu::String sRet; -- cgit v1.2.3