summaryrefslogtreecommitdiff
path: root/klm/lm/trie.cc
diff options
context:
space:
mode:
authorWu, Ke <wuke@cs.umd.edu>2014-12-17 16:11:38 -0500
committerWu, Ke <wuke@cs.umd.edu>2014-12-17 16:11:38 -0500
commit1613f1fc44ca67820afd7e7b21eb54b316c8ce55 (patch)
treee02b77084f28a18df6b854f87a986124db44d717 /klm/lm/trie.cc
parentbd9308e22b5434aa220cc57d82ee867464a011f1 (diff)
parent796768086a687d3f1856fef6489c34fe4d373642 (diff)
Merge with upstream
Diffstat (limited to 'klm/lm/trie.cc')
-rw-r--r--klm/lm/trie.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/klm/lm/trie.cc b/klm/lm/trie.cc
index d9895f89..5f8e7ce7 100644
--- a/klm/lm/trie.cc
+++ b/klm/lm/trie.cc
@@ -99,8 +99,11 @@ template <class Bhiksha> util::BitAddress BitPackedMiddle<Bhiksha>::Find(WordInd
}
template <class Bhiksha> void BitPackedMiddle<Bhiksha>::FinishedLoading(uint64_t next_end, const Config &config) {
- uint64_t last_next_write = (insert_index_ + 1) * total_bits_ - bhiksha_.InlineBits();
- bhiksha_.WriteNext(base_, last_next_write, insert_index_ + 1, next_end);
+ // Write at insert_index. . .
+ uint64_t last_next_write = insert_index_ * total_bits_ +
+ // at the offset where the next pointers are stored.
+ (total_bits_ - bhiksha_.InlineBits());
+ bhiksha_.WriteNext(base_, last_next_write, insert_index_, next_end);
bhiksha_.FinishedLoading(config);
}