aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/suggest/policyimpl/utils/edit_distance.h
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-03-06 21:34:45 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-06 21:34:45 -0800
commit3ee2196cfb7c49a974b5e3e1637f0d9b9b2c28c6 (patch)
treec49b06b612cd4c61958d7b9e8a4e6d2d39d6fe40 /native/jni/src/suggest/policyimpl/utils/edit_distance.h
parenta2293ec906563b39d2613201e7b14301c6afb6d4 (diff)
parent9c2f003d598e2519637007ef4d918022521bdecf (diff)
downloadlatinime-3ee2196cfb7c49a974b5e3e1637f0d9b9b2c28c6.tar.gz
latinime-3ee2196cfb7c49a974b5e3e1637f0d9b9b2c28c6.tar.xz
latinime-3ee2196cfb7c49a974b5e3e1637f0d9b9b2c28c6.zip
am 9c2f003d: Merge "Revert "Revert "Use std::min() and std::max()"""
* commit '9c2f003d598e2519637007ef4d918022521bdecf': Revert "Revert "Use std::min() and std::max()""
Diffstat (limited to 'native/jni/src/suggest/policyimpl/utils/edit_distance.h')
-rw-r--r--native/jni/src/suggest/policyimpl/utils/edit_distance.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/native/jni/src/suggest/policyimpl/utils/edit_distance.h b/native/jni/src/suggest/policyimpl/utils/edit_distance.h
index 0871c37ce..4cfd0b3f3 100644
--- a/native/jni/src/suggest/policyimpl/utils/edit_distance.h
+++ b/native/jni/src/suggest/policyimpl/utils/edit_distance.h
@@ -17,6 +17,8 @@
#ifndef LATINIME_EDIT_DISTANCE_H
#define LATINIME_EDIT_DISTANCE_H
+#include <algorithm>
+
#include "defines.h"
#include "suggest/policyimpl/utils/edit_distance_policy.h"
@@ -38,13 +40,13 @@ class EditDistance {
for (int i = 0; i < beforeLength; ++i) {
for (int j = 0; j < afterLength; ++j) {
- dp[(afterLength + 1) * (i + 1) + (j + 1)] = min(
+ dp[(afterLength + 1) * (i + 1) + (j + 1)] = std::min(
dp[(afterLength + 1) * i + (j + 1)] + policy->getInsertionCost(i, j),
- min(dp[(afterLength + 1) * (i + 1) + j] + policy->getDeletionCost(i, j),
- dp[(afterLength + 1) * i + j]
- + policy->getSubstitutionCost(i, j)));
+ std::min(
+ dp[(afterLength + 1) * (i + 1) + j] + policy->getDeletionCost(i, j),
+ dp[(afterLength + 1) * i + j] + policy->getSubstitutionCost(i, j)));
if (policy->allowTransposition(i, j)) {
- dp[(afterLength + 1) * (i + 1) + (j + 1)] = min(
+ dp[(afterLength + 1) * (i + 1) + (j + 1)] = std::min(
dp[(afterLength + 1) * (i + 1) + (j + 1)],
dp[(afterLength + 1) * (i - 1) + (j - 1)]
+ policy->getTranspositionCost(i, j));