diff options
| author | Mike Buland <mike@xagasoft.com> | 2013-04-19 15:36:29 -0600 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2013-04-19 15:36:29 -0600 |
| commit | 7260c36973fc0ad7ff24294ff5540d64bf32c334 (patch) | |
| tree | 72e74744a789d4c1acedfa1afd1a07219cce9931 /src/packedintarray.cpp | |
| parent | 9ad1a65f4dcbc31b031556803d27dc688a16ff4a (diff) | |
| download | clic-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 '')
| -rw-r--r-- | src/packedintarray.cpp | 17 |
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 | ||
| 67 | void PackedIntArray::zero() | ||
| 68 | { | ||
| 69 | int iSize = StoreCount(iCapacity); | ||
| 70 | memset( aData, 0, iSize*sizeof(Store)); | ||
| 71 | } | ||
| 72 | |||
| 67 | void PackedIntArray::append( PackedIntArray::Unit i ) | 73 | void 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 | ||
| 126 | void 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 | |||
| 120 | void PackedIntArray::set( const PackedIntArray &rSrc, int iStart, int iSize ) | 137 | void PackedIntArray::set( const PackedIntArray &rSrc, int iStart, int iSize ) |
| 121 | { | 138 | { |
| 122 | iCount = iSize; | 139 | iCount = iSize; |
