am 628a6484
: Merge "Fix: wrong size checking in SparseTable."
* commit '628a64847c3313e36e21e6d2a4960c7aace989c7': Fix: wrong size checking in SparseTable.
This commit is contained in:
commit
750e3a4673
1 changed files with 5 additions and 7 deletions
|
@ -41,13 +41,11 @@ uint32_t SparseTable::get(const int id) const {
|
||||||
bool SparseTable::set(const int id, const uint32_t value) {
|
bool SparseTable::set(const int id, const uint32_t value) {
|
||||||
const int posInIndexTable = getPosInIndexTable(id);
|
const int posInIndexTable = getPosInIndexTable(id);
|
||||||
// Extends the index table if needed.
|
// Extends the index table if needed.
|
||||||
if (mIndexTableBuffer->getTailPosition() < posInIndexTable) {
|
int tailPos = mIndexTableBuffer->getTailPosition();
|
||||||
int tailPos = mIndexTableBuffer->getTailPosition();
|
while (tailPos <= posInIndexTable) {
|
||||||
while(tailPos < posInIndexTable) {
|
if (!mIndexTableBuffer->writeUintAndAdvancePosition(NOT_EXIST, INDEX_SIZE, &tailPos)) {
|
||||||
if (!mIndexTableBuffer->writeUintAndAdvancePosition(NOT_EXIST, INDEX_SIZE, &tailPos)) {
|
AKLOGE("cannot extend index table. tailPos: %d to: %d", tailPos, posInIndexTable);
|
||||||
AKLOGE("cannot extend index table. tailPos: %d to: %d", tailPos, posInIndexTable);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contains(id)) {
|
if (contains(id)) {
|
||||||
|
|
Loading…
Reference in a new issue