diff options
author | 2012-03-02 12:18:34 +0900 | |
---|---|---|
committer | 2012-03-02 12:34:17 +0900 | |
commit | bb0bd66942751e51653b1b7997c15ef35f9fc07d (patch) | |
tree | bc50b265946fdbe1604b556acbca5ed49dcc5da6 /native/src | |
parent | 961703841e89a274122c87541d1151fd91672ddc (diff) | |
download | latinime-bb0bd66942751e51653b1b7997c15ef35f9fc07d.tar.gz latinime-bb0bd66942751e51653b1b7997c15ef35f9fc07d.tar.xz latinime-bb0bd66942751e51653b1b7997c15ef35f9fc07d.zip |
Fix correction utility
Bug: 6096247
Change-Id: Ie17c60dde9bd081790b79312ce8d96d292c5128c
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/correction.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/native/src/correction.h b/native/src/correction.h index 2114eff4b..ee55c9604 100644 --- a/native/src/correction.h +++ b/native/src/correction.h @@ -17,6 +17,7 @@ #ifndef LATINIME_CORRECTION_H #define LATINIME_CORRECTION_H +#include <assert.h> #include <stdint.h> #include "correction_state.h" @@ -50,7 +51,14 @@ class Correction { const int temp = *base; if (temp != S_INT_MAX) { // Branch if multiplier == 2 for the optimization - if (multiplier == 2) { + if (multiplier < 0) { + if (DEBUG_DICT) { + assert(false); + } + AKLOGI("--- Invalid multiplier: %d", multiplier); + } else if (multiplier == 0) { + *base = 0; + } else if (multiplier == 2) { *base = TWO_31ST_DIV_2 >= temp ? temp << 1 : S_INT_MAX; } else { // TODO: This overflow check gives a wrong answer when, for example, |