Loading native/src/correction.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -429,6 +429,9 @@ inline static void multiplyIntCapped(const int multiplier, int *base) { 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, // temp = 2^16 + 1 and multiplier = 2^17 + 1. // Fix this behavior. const int tempRetval = temp * multiplier; *base = tempRetval >= temp ? tempRetval : S_INT_MAX; } Loading native/src/unigram_dictionary.cpp +0 −14 Original line number Diff line number Diff line Loading @@ -348,20 +348,6 @@ void UnigramDictionary::getSuggestionCandidates() { } } static const int TWO_31ST_DIV_2 = S_INT_MAX / 2; inline static void multiplyIntCapped(const int multiplier, int *base) { const int temp = *base; if (temp != S_INT_MAX) { // Branch if multiplier == 2 for the optimization if (multiplier == 2) { *base = TWO_31ST_DIV_2 >= temp ? temp << 1 : S_INT_MAX; } else { const int tempRetval = temp * multiplier; *base = tempRetval >= temp ? tempRetval : S_INT_MAX; } } } void UnigramDictionary::getMissingSpaceWords( const int inputLength, const int missingSpacePos, Correction *correction) { correction->setCorrectionParams(-1 /* skipPos */, -1 /* excessivePos */, Loading Loading
native/src/correction.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -429,6 +429,9 @@ inline static void multiplyIntCapped(const int multiplier, int *base) { 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, // temp = 2^16 + 1 and multiplier = 2^17 + 1. // Fix this behavior. const int tempRetval = temp * multiplier; *base = tempRetval >= temp ? tempRetval : S_INT_MAX; } Loading
native/src/unigram_dictionary.cpp +0 −14 Original line number Diff line number Diff line Loading @@ -348,20 +348,6 @@ void UnigramDictionary::getSuggestionCandidates() { } } static const int TWO_31ST_DIV_2 = S_INT_MAX / 2; inline static void multiplyIntCapped(const int multiplier, int *base) { const int temp = *base; if (temp != S_INT_MAX) { // Branch if multiplier == 2 for the optimization if (multiplier == 2) { *base = TWO_31ST_DIV_2 >= temp ? temp << 1 : S_INT_MAX; } else { const int tempRetval = temp * multiplier; *base = tempRetval >= temp ? tempRetval : S_INT_MAX; } } } void UnigramDictionary::getMissingSpaceWords( const int inputLength, const int missingSpacePos, Correction *correction) { correction->setCorrectionParams(-1 /* skipPos */, -1 /* excessivePos */, Loading