am cdc260b7: Merge "Fix TrieMap: Cannot create next level map of small value entry."
* commit 'cdc260b78ed8d73b9e425ac55f3b5f9dab8bf753': Fix TrieMap: Cannot create next level map of small value entry.main
commit
c4f827f81f
|
@ -85,7 +85,7 @@ int TrieMap::getNextLevelBitmapEntryIndex(const int key, const int bitmapEntryIn
|
||||||
if (!writeEntry(EMPTY_BITMAP_ENTRY, valueEntryIndex + 1)) {
|
if (!writeEntry(EMPTY_BITMAP_ENTRY, valueEntryIndex + 1)) {
|
||||||
return INVALID_INDEX;
|
return INVALID_INDEX;
|
||||||
}
|
}
|
||||||
if (!writeField1(valueEntryIndex | TERMINAL_LINK_FLAG, valueEntryIndex)) {
|
if (!writeField1(valueEntryIndex | TERMINAL_LINK_FLAG, terminalEntryIndex)) {
|
||||||
return INVALID_INDEX;
|
return INVALID_INDEX;
|
||||||
}
|
}
|
||||||
return valueEntryIndex + 1;
|
return valueEntryIndex + 1;
|
||||||
|
|
|
@ -40,6 +40,7 @@ TEST(TrieMapTest, TestSetAndGet) {
|
||||||
trieMap.putRoot(11, 1000);
|
trieMap.putRoot(11, 1000);
|
||||||
EXPECT_EQ(1000ull, trieMap.getRoot(11).mValue);
|
EXPECT_EQ(1000ull, trieMap.getRoot(11).mValue);
|
||||||
const int next = trieMap.getNextLevelBitmapEntryIndex(10);
|
const int next = trieMap.getNextLevelBitmapEntryIndex(10);
|
||||||
|
EXPECT_EQ(1000ull, trieMap.getRoot(10).mValue);
|
||||||
trieMap.put(9, 9, next);
|
trieMap.put(9, 9, next);
|
||||||
EXPECT_EQ(9ull, trieMap.get(9, next).mValue);
|
EXPECT_EQ(9ull, trieMap.get(9, next).mValue);
|
||||||
EXPECT_FALSE(trieMap.get(11, next).mIsValid);
|
EXPECT_FALSE(trieMap.get(11, next).mIsValid);
|
||||||
|
|
Loading…
Reference in New Issue