summaryrefslogtreecommitdiff
path: root/src/packedintarray.cpp
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2013-04-19 15:36:29 -0600
committerMike Buland <mike@xagasoft.com>2013-04-19 15:36:29 -0600
commit7260c36973fc0ad7ff24294ff5540d64bf32c334 (patch)
tree72e74744a789d4c1acedfa1afd1a07219cce9931 /src/packedintarray.cpp
parent9ad1a65f4dcbc31b031556803d27dc688a16ff4a (diff)
downloadclic-7260c36973fc0ad7ff24294ff5540d64bf32c334.tar.gz
clic-7260c36973fc0ad7ff24294ff5540d64bf32c334.tar.bz2
clic-7260c36973fc0ad7ff24294ff5540d64bf32c334.tar.xz
clic-7260c36973fc0ad7ff24294ff5540d64bf32c334.zip
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.
Diffstat (limited to 'src/packedintarray.cpp')
-rw-r--r--src/packedintarray.cpp17
1 files changed, 17 insertions, 0 deletions
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()
64 iCount = 0; 64 iCount = 0;
65} 65}
66 66
67void PackedIntArray::zero()
68{
69 int iSize = StoreCount(iCapacity);
70 memset( aData, 0, iSize*sizeof(Store));
71}
72
67void PackedIntArray::append( PackedIntArray::Unit i ) 73void PackedIntArray::append( PackedIntArray::Unit i )
68{ 74{
69 iCount++; 75 iCount++;
@@ -117,6 +123,17 @@ void PackedIntArray::set( int idx, PackedIntArray::Unit i )
117 } 123 }
118} 124}
119 125
126void PackedIntArray::insert( int idx, Unit i )
127{
128 iCount++;
129 checkCapacity();
130 for( int j = iCount-1; j > idx; j-- )
131 {
132 set( j, get( j-1 ) );
133 }
134 set( idx, i );
135}
136
120void PackedIntArray::set( const PackedIntArray &rSrc, int iStart, int iSize ) 137void PackedIntArray::set( const PackedIntArray &rSrc, int iStart, int iSize )
121{ 138{
122 iCount = iSize; 139 iCount = iSize;