diff options
-rw-r--r-- | src/util/lcs.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/util/lcs.h b/src/util/lcs.h index 68ff172e59..58101e989f 100644 --- a/src/util/lcs.h +++ b/src/util/lcs.h @@ -1,24 +1,24 @@ -#include <cstring> - #include <QString> +#include <QVector> +#include <cstring> // Returns the longest common substring shared between a and b. Does not support // finding multiple longest common substrings. inline QString LCS(const QString& a, const QString& b) { - const size_t m = a.size(); - const size_t n = b.size(); - const size_t rows = m + 1; - const size_t cols = n + 1; + const int m = a.size(); + const int n = b.size(); + const int rows = m + 1; + const int cols = n + 1; - QVector<QVector<size_t> > M(rows); - size_t longest = 0; - size_t longest_loc = 0; + QVector<QVector<int> > M(rows); + int longest = 0; + int longest_loc = 0; - for (size_t i = 0; i < rows; ++i) { - M[i] = QVector<size_t>(cols, 0); + for (int i = 0; i < rows; ++i) { + M[i] = QVector<int>(cols, 0); } - for (size_t i = 1; i <= m; ++i) { - for (size_t j = 1; j <= n; ++j) { + for (int i = 1; i <= m; ++i) { + for (int j = 1; j <= n; ++j) { if (a.at(i-1) == b.at(j-1)) { M[i][j] = M[i-1][j-1] + 1; if (M[i][j] > longest) { |