From 7260c36973fc0ad7ff24294ff5540d64bf32c334 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 19 Apr 2013 15:36:29 -0600 Subject: Fractional divisoin works. It doesn't round yet, and there's a chance I should be increasing the precision, right now it keeps the precision of the left hand side number. --- src/packedintarray.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/packedintarray.cpp') diff --git a/src/packedintarray.cpp b/src/packedintarray.cpp index bcd2f66..5397a73 100644 --- a/src/packedintarray.cpp +++ b/src/packedintarray.cpp @@ -64,6 +64,12 @@ void PackedIntArray::clear() iCount = 0; } +void PackedIntArray::zero() +{ + int iSize = StoreCount(iCapacity); + memset( aData, 0, iSize*sizeof(Store)); +} + void PackedIntArray::append( PackedIntArray::Unit i ) { iCount++; @@ -117,6 +123,17 @@ void PackedIntArray::set( int idx, PackedIntArray::Unit i ) } } +void PackedIntArray::insert( int idx, Unit i ) +{ + iCount++; + checkCapacity(); + for( int j = iCount-1; j > idx; j-- ) + { + set( j, get( j-1 ) ); + } + set( idx, i ); +} + void PackedIntArray::set( const PackedIntArray &rSrc, int iStart, int iSize ) { iCount = iSize; -- cgit v1.2.3