Skip to content

Commit

Permalink
Merge pull request kpu#294 from wengxt/master
Browse files Browse the repository at this point in the history
Fix Quantize bit packing on big endian.
  • Loading branch information
kpu authored Aug 29, 2020
2 parents 7f623ad + 413e7fd commit a88fa7d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lm/quantize.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a88fa7d

Please sign in to comment.