Skip to content
Snippets Groups Projects
Commit b7677156 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android (Google) Code Review
Browse files

Merge "Fix: incompatibility of sparse table."

parents 214a3b74 9b08a9e6
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment