diff options
author | 2014-10-22 11:31:16 +0900 | |
---|---|---|
committer | 2014-10-22 11:31:16 +0900 | |
commit | c9865785f41e3dcbe9308f653afc69603c1e44c0 (patch) | |
tree | 7608a52769d7b86a1d61fece57a462dafe69e1c9 /native/jni/src/utils/char_utils.h | |
parent | 0b8bb0c21bda18e77a52d980891d56430e113a6f (diff) | |
download | latinime-c9865785f41e3dcbe9308f653afc69603c1e44c0.tar.gz latinime-c9865785f41e3dcbe9308f653afc69603c1e44c0.tar.xz latinime-c9865785f41e3dcbe9308f653afc69603c1e44c0.zip |
Support ngram entry migration.
Bug: 14425059
Change-Id: I98cb9fa303af2d93a0a3512e8732231c564e3c5d
Diffstat (limited to 'native/jni/src/utils/char_utils.h')
-rw-r--r-- | native/jni/src/utils/char_utils.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/native/jni/src/utils/char_utils.h b/native/jni/src/utils/char_utils.h index 5e9cdd9b2..7871c26ef 100644 --- a/native/jni/src/utils/char_utils.h +++ b/native/jni/src/utils/char_utils.h @@ -101,6 +101,17 @@ class CharUtils { return codePointCount + 1; } + // Returns updated code point count. + static AK_FORCE_INLINE int removeBeginningOfSentenceMarker(int *const codePoints, + const int codePointCount) { + if (codePointCount <= 0 || codePoints[0] != CODE_POINT_BEGINNING_OF_SENTENCE) { + return codePointCount; + } + const int newCodePointCount = codePointCount - 1; + memmove(codePoints, codePoints + 1, sizeof(int) * newCodePointCount); + return newCodePointCount; + } + private: DISALLOW_IMPLICIT_CONSTRUCTORS(CharUtils); |