summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-07-15 17:17:27 +0900
committerMaxime Coste <mawww@kakoune.org>2017-07-15 17:17:27 +0900
commit5eae7aacc75e16272cffe033097adcbe2e314e96 (patch)
tree72d2d84b3d3372f84f2daf4a8cdcd6e2efb2394d /src
parent6e40e57ed468a535d6a1a5b4dad6a9da50dc8276 (diff)
Small code cleanup in diff implementation
Diffstat (limited to 'src')
-rw-r--r--src/diff.hh12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/diff.hh b/src/diff.hh
index 13f7dc40..c8063b1d 100644
--- a/src/diff.hh
+++ b/src/diff.hh
@@ -39,20 +39,14 @@ Snake find_end_snake_of_further_reaching_dpath(Iterator a, int N, Iterator b, in
const MirroredArray<int>& V,
const int D, const int k, Equal eq)
{
- int x; // our position along a
-
const bool add = k == -D or (k != D and V[k-1] < V[k+1]);
// if diagonal on the right goes further along x than diagonal on the left,
// then we take a vertical edge from it to this diagonal, hence x = V[k+1]
- if (add)
- x = V[k+1];
// else, we take an horizontal edge from our left diagonal,x = V[k-1]+1
- else
- x = V[k-1]+1;
-
- int y = x - k; // we are by construction on diagonal k, so our position along
- // b (y) is x - k.
+ const int x = add ? V[k+1] : V[k-1]+1;
+ // we are by construction on diagonal k, so our position along b (y) is x - k.
+ const int y = x - k;
int u = x, v = y;
// follow end snake along diagonal k