summaryrefslogtreecommitdiff
path: root/src/diff.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-05-15 13:55:39 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-05-15 13:55:39 +0100
commit73ddf18dc3144c20b0eb88accd69d1b8b851d855 (patch)
tree5cbc28634391f30bc38e3e5d338f17811caea27f /src/diff.hh
parent802d6e106cb6a58ea2b0d4d0c986614e1713f34c (diff)
Another bug fix in diff implementation
Diffstat (limited to 'src/diff.hh')
-rw-r--r--src/diff.hh8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/diff.hh b/src/diff.hh
index da1328e2..fe679bd6 100644
--- a/src/diff.hh
+++ b/src/diff.hh
@@ -97,7 +97,7 @@ SnakeLen find_middle_snake(Iterator a, int N, Iterator b, int M,
if ((delta % 2 == 0) and -D <= k1 and k1 <= D)
{
if (V1[k1] + V2[k2] >= N)
- return { { N - p.u, M - p.v, N - p.x , M - p.y } , 2 * D };// return last snake on reverse path
+ return { { N - p.u, M - p.v, N - p.x , M - p.y, p.add } , 2 * D };// return last snake on reverse path
}
}
}
@@ -138,11 +138,7 @@ void find_diff_rec(Iterator a, int offA, int lenA,
}
else if (middle_snake.d == 1)
{
- int diag = 0;
- while (eq(a[offA + diag], b[offB + diag]))
- ++diag;
-
- if (diag != 0)
+ if (int diag = middle_snake.x - (middle_snake.add ? 0 : 1))
diffs.push_back({Diff::Keep, diag, 0});
if (middle_snake.add)