Inspired by the thoroughly stale https://github.com/git/git/pull/159,
this patch fixes a couple of typos, rewraps and clarifies some comments.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Johannes Schindelin5 years agocommitted byJunio C Hamano
* Basically considers a "box" (off1, off2, lim1, lim2) and scan from both
* the forward diagonal starting from (off1, off2) and the backward diagonal
* starting from (lim1, lim2). If the K values on the same diagonal crosses
* returns the furthest point of reach. We might end up having to expensive
* cases using this algorithm is full, so a little bit of heuristic is needed
* to cut the search and to return a suboptimal point.
* returns the furthest point of reach. We might encounter expensive edge cases
* using this algorithm, so a little bit of heuristic is needed to cut the
* search and to return a suboptimal point.
*/
static long xdl_split(unsigned long const *ha1, long off1, long lim1,
unsigned long const *ha2, long off2, long lim2,
@ -63,11 +63,13 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
@@ -63,11 +63,13 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
int got_snake = 0;
/*
* We need to extent the diagonal "domain" by one. If the next
* We need to extend the diagonal "domain" by one. If the next
* values exits the box boundaries we need to change it in the
* opposite direction because (max - min) must be a power of two.
* opposite direction because (max - min) must be a power of
* two.
*
* Also we initialize the external K value to -1 so that we can
* avoid extra conditions check inside the core loop.
* avoid extra conditions in the check inside the core loop.
*/
if (fmin > dmin)
kvdf[--fmin - 1] = -1;
@ -98,11 +100,13 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
@@ -98,11 +100,13 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
}
/*
* We need to extent the diagonal "domain" by one. If the next
* We need to extend the diagonal "domain" by one. If the next
* values exits the box boundaries we need to change it in the
* opposite direction because (max - min) must be a power of two.
* opposite direction because (max - min) must be a power of
* two.
*
* Also we initialize the external K value to -1 so that we can
* avoid extra conditions check inside the core loop.
* avoid extra conditions in the check inside the core loop.
*/
if (bmin > dmin)
kvdb[--bmin - 1] = XDL_LINE_MAX;
@ -138,7 +142,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
@@ -138,7 +142,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
/*
* If the edit cost is above the heuristic trigger and if
* we got a good snake, we sample current diagonals to see
* if some of the, have reached an "interesting" path. Our
* if some of them have reached an "interesting" path. Our
* measure is a function of the distance from the diagonal
* corner (i1 + i2) penalized with the distance from the
* mid diagonal itself. If this value is above the current
@ -196,8 +200,9 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
@@ -196,8 +200,9 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
}
/*
* Enough is enough. We spent too much time here and now we collect
* the furthest reaching path using the (i1 + i2) measure.
* Enough is enough. We spent too much time here and now we
* collect the furthest reaching path using the (i1 + i2)
* measure.
*/
if (ec >= xenv->mxcost) {
long fbest, fbest1, bbest, bbest1;
@ -244,9 +249,9 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
@@ -244,9 +249,9 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,
/*
* Rule: "Divide et Impera". Recursively split the box in sub-boxes by calling
* the box splitting function. Note that the real job (marking changed lines)
* is done in the two boundary reaching checks.
* Rule: "Divide et Impera" (divide & conquer). Recursively split the box in
* sub-boxes by calling the box splitting function. Note that the real job
* (marking changed lines) is done in the two boundary reaching checks.
*/
int xdl_recs_cmp(diffdata_t *dd1, long off1, long lim1,