Fix: incompatibility of sparse table.
Bug: 11073222 Change-Id: Id17178efd8f9f3828d821cc718d35606e8bd4b1amain
parent
56e7e38d37
commit
9b08a9e611
|
@ -48,8 +48,8 @@ const int Ver4DictConstants::TIME_STAMP_FIELD_SIZE = 4;
|
|||
const int Ver4DictConstants::WORD_LEVEL_FIELD_SIZE = 1;
|
||||
const int Ver4DictConstants::WORD_COUNT_FIELD_SIZE = 1;
|
||||
|
||||
const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_BLOCK_SIZE = 4;
|
||||
const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_DATA_SIZE = 16;
|
||||
const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_BLOCK_SIZE = 16;
|
||||
const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_DATA_SIZE = 4;
|
||||
const int Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE = 64;
|
||||
const int Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_DATA_SIZE = 4;
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ uint32_t SparseTable::get(const int id) const {
|
|||
const int indexTableReadingPos = getPosInIndexTable(id);
|
||||
const int index = mIndexTableBuffer->readUint(INDEX_SIZE, indexTableReadingPos);
|
||||
const int contentTableReadingPos = getPosInContentTable(id, index);
|
||||
return mContentTableBuffer->readUint(mDataSize, contentTableReadingPos);
|
||||
const int contentValue = mContentTableBuffer->readUint(mDataSize, contentTableReadingPos);
|
||||
return contentValue == NOT_EXIST ? NOT_A_DICT_POS : contentValue;
|
||||
}
|
||||
|
||||
bool SparseTable::set(const int id, const uint32_t value) {
|
||||
|
@ -70,7 +71,7 @@ bool SparseTable::set(const int id, const uint32_t value) {
|
|||
// Write a new block that containing the entry to be set.
|
||||
int writingPos = getPosInContentTable(0 /* id */, index);
|
||||
for (int i = 0; i < mBlockSize; ++i) {
|
||||
if (!mContentTableBuffer->writeUintAndAdvancePosition(NOT_A_DICT_POS, mDataSize,
|
||||
if (!mContentTableBuffer->writeUintAndAdvancePosition(NOT_EXIST, mDataSize,
|
||||
&writingPos)) {
|
||||
AKLOGE("cannot write content table to extend. writingPos: %d, tailPos: %d, "
|
||||
"mDataSize: %d", writingPos, mContentTableBuffer->getTailPosition(), mDataSize);
|
||||
|
|
Loading…
Reference in New Issue