Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lm
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2013-01-09 17:15:04 +0400
committerKenneth Heafield <github@kheafield.com>2013-01-09 17:15:04 +0400
commit1530ae4f5ff59cfd30f6f933e4dc05ea89cca8fc (patch)
treea7a5b0186d0ee26b9c2dcd0758ee5db4a1d0692c /lm
parent936dbf6516e6388156951971acc06aa353255d11 (diff)
Fix state comparison (impacted 32-bit)lexi_RELEASE-1.0RELEASE-1.0GHK
Diffstat (limited to 'lm')
-rw-r--r--lm/state.hh6
1 files changed, 3 insertions, 3 deletions
diff --git a/lm/state.hh b/lm/state.hh
index 551510a8e..d8e6c132b 100644
--- a/lm/state.hh
+++ b/lm/state.hh
@@ -56,14 +56,14 @@ inline uint64_t hash_value(const State &state, uint64_t seed = 0) {
struct Left {
bool operator==(const Left &other) const {
return
- (length == other.length) &&
- pointers[length - 1] == other.pointers[length - 1] &&
- full == other.full;
+ length == other.length &&
+ (!length || (pointers[length - 1] == other.pointers[length - 1] && full == other.full));
}
int Compare(const Left &other) const {
if (length < other.length) return -1;
if (length > other.length) return 1;
+ if (length == 0) return 0; // Must be full.
if (pointers[length - 1] > other.pointers[length - 1]) return 1;
if (pointers[length - 1] < other.pointers[length - 1]) return -1;
return (int)full - (int)other.full;