aboutsummaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
Diffstat (limited to 'native/src')
-rw-r--r--native/src/correction.h3
-rw-r--r--native/src/defines.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/native/src/correction.h b/native/src/correction.h
index f3194b788..41130ad77 100644
--- a/native/src/correction.h
+++ b/native/src/correction.h
@@ -119,8 +119,9 @@ private:
int mTerminalInputIndex;
int mTerminalOutputIndex;
unsigned short mWord[MAX_WORD_LENGTH_INTERNAL];
+ // Edit distance calculation requires a buffer with (N+1)^2 length for the input length N.
// Caveat: Do not create multiple tables per thread as this table eats up RAM a lot.
- int mEditDistanceTable[MAX_WORD_LENGTH_INTERNAL * MAX_WORD_LENGTH_INTERNAL];
+ int mEditDistanceTable[(MAX_WORD_LENGTH_INTERNAL + 1) * (MAX_WORD_LENGTH_INTERNAL + 1)];
CorrectionState mCorrectionStates[MAX_WORD_LENGTH_INTERNAL];
diff --git a/native/src/defines.h b/native/src/defines.h
index 009d0ad3d..55469a788 100644
--- a/native/src/defines.h
+++ b/native/src/defines.h
@@ -131,7 +131,7 @@ static void dumpWord(const unsigned short* word, const int length) {
#endif // FLAG_DBG
#ifndef U_SHORT_MAX
-#define U_SHORT_MAX 1 << 16
+#define U_SHORT_MAX 65535 // ((1 << 16) - 1)
#endif
#ifndef S_INT_MAX
#define S_INT_MAX 2147483647 // ((1 << 31) - 1)