diff options
author | Kenneth Heafield <kenlm@kheafield.com> | 2011-09-26 16:54:16 -0400 |
---|---|---|
committer | Kenneth Heafield <kenlm@kheafield.com> | 2011-09-26 16:54:16 -0400 |
commit | 8668b6a55854eda404e29a80ace4027e1ffd2e5b (patch) | |
tree | 1da0fb2af7212efcbb10293e283a9c9dcf2430c3 /klm/lm/trie.hh | |
parent | a730085e77c5eb80b2b71dfcb05e0b6a27b2140c (diff) |
Fix trie pointer segfault
Diffstat (limited to 'klm/lm/trie.hh')
-rw-r--r-- | klm/lm/trie.hh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/klm/lm/trie.hh b/klm/lm/trie.hh index a9f5e417..06cc96ac 100644 --- a/klm/lm/trie.hh +++ b/klm/lm/trie.hh @@ -99,10 +99,11 @@ template <class Quant, class Bhiksha> class BitPackedMiddle : public BitPacked { bool FindNoProb(WordIndex word, float &backoff, NodeRange &range) const; NodeRange ReadEntry(uint64_t pointer, float &prob) { - quant_.ReadProb(base_, pointer, prob); + uint64_t addr = pointer * total_bits_; + addr += word_bits_; + quant_.ReadProb(base_, addr, prob); NodeRange ret; - // pointer/total_bits_ should always round down. - bhiksha_.ReadNext(base_, pointer + quant_.TotalBits(), pointer / total_bits_, total_bits_, ret); + bhiksha_.ReadNext(base_, addr + quant_.TotalBits(), pointer, total_bits_, ret); return ret; } |