diff options
Diffstat (limited to 'native/jni/src/utils')
-rw-r--r-- | native/jni/src/utils/autocorrection_threshold_utils.cpp | 3 | ||||
-rw-r--r-- | native/jni/src/utils/hash_map_compat.h | 16 |
2 files changed, 7 insertions, 12 deletions
diff --git a/native/jni/src/utils/autocorrection_threshold_utils.cpp b/native/jni/src/utils/autocorrection_threshold_utils.cpp index 1f8ee0814..349786a27 100644 --- a/native/jni/src/utils/autocorrection_threshold_utils.cpp +++ b/native/jni/src/utils/autocorrection_threshold_utils.cpp @@ -16,6 +16,7 @@ #include "utils/autocorrection_threshold_utils.h" +#include <algorithm> #include <cmath> #include "defines.h" @@ -99,7 +100,7 @@ const int AutocorrectionThresholdUtils::FULL_WORD_MULTIPLIER = 2; const float maxScore = score >= S_INT_MAX ? static_cast<float>(S_INT_MAX) : static_cast<float>(MAX_INITIAL_SCORE) * powf(static_cast<float>(TYPED_LETTER_MULTIPLIER), - static_cast<float>(min(beforeLength, afterLength - spaceCount))) + static_cast<float>(std::min(beforeLength, afterLength - spaceCount))) * static_cast<float>(FULL_WORD_MULTIPLIER); return (static_cast<float>(score) / maxScore) * weight; diff --git a/native/jni/src/utils/hash_map_compat.h b/native/jni/src/utils/hash_map_compat.h index a1e982bc4..7bf35a660 100644 --- a/native/jni/src/utils/hash_map_compat.h +++ b/native/jni/src/utils/hash_map_compat.h @@ -17,18 +17,12 @@ #ifndef LATINIME_HASH_MAP_COMPAT_H #define LATINIME_HASH_MAP_COMPAT_H -// TODO: Use std::unordered_map that has been standardized in C++11 +#include <unordered_map> -#ifdef __APPLE__ -#include <ext/hash_map> -#else // __APPLE__ -#include <hash_map> -#endif // __APPLE__ +#define hash_map_compat std::unordered_map -#ifdef __SGI_STL_PORT -#define hash_map_compat stlport::hash_map -#else // __SGI_STL_PORT -#define hash_map_compat __gnu_cxx::hash_map -#endif // __SGI_STL_PORT +#if 0 // TODO: Use this instead of the above macro. +template <typename TKey, typename TValue> using hash_map_compat = std::unordered_map<TKey, TValue>; +#endif #endif // LATINIME_HASH_MAP_COMPAT_H |