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

github.com/kpu/kenlm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <kpu@users.noreply.github.com>2020-08-29 20:06:21 +0300
committerGitHub <noreply@github.com>2020-08-29 20:06:21 +0300
commita88fa7d65c7c52e51dc194933d92e864d3b56c2e (patch)
tree3e8d50e04723274653f70fedee287b4e69b10cb4
parent7f623adcab0e52cca7fa123efc9d3828c438524f (diff)
parent413e7fdd6d5cfb174674965db340de86079adfda (diff)
Merge pull request #294 from wengxt/master
Fix Quantize bit packing on big endian.
-rw-r--r--lm/quantize.hh9
1 files changed, 4 insertions, 5 deletions
diff --git a/lm/quantize.hh b/lm/quantize.hh
index 3dce7e1..1faac37 100644
--- a/lm/quantize.hh
+++ b/lm/quantize.hh
@@ -169,15 +169,14 @@ class SeparatelyQuantize {
void Write(float prob, float backoff) const {
uint64_t prob_encoded = ProbBins().EncodeProb(prob);
- uint64_t backoff_encoded = BackoffBins().EncodeBackoff(backoff);
+ uint64_t backoff_encoded = BackoffBins().EncodeBackoff(backoff);
#if BYTE_ORDER == LITTLE_ENDIAN
- prob_encoded
+ prob_encoded <<= BackoffBins().Bits();
#elif BYTE_ORDER == BIG_ENDIAN
- backoff_encoded
+ backoff_encoded <<= ProbBins().Bits();
#endif
- <<= BackoffBins().Bits();
util::WriteInt57(address_.base, address_.offset, ProbBins().Bits() + BackoffBins().Bits(),
- prob_encoded | backoff_encoded);
+ prob_encoded | backoff_encoded);
}
private: