diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-12-06 19:01:00 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-12-06 19:01:00 -0500 |
commit | 83f7d702e7428c394b601b211dfa3fbb615267ff (patch) | |
tree | 02aab228eb7b47d565d673c65729a7a0dc57acf0 /klippy/stepcompress.c | |
parent | 12d4888321bdf44e2a6912b1c58188e748d99a9d (diff) | |
download | kutter-83f7d702e7428c394b601b211dfa3fbb615267ff.tar.gz kutter-83f7d702e7428c394b601b211dfa3fbb615267ff.tar.xz kutter-83f7d702e7428c394b601b211dfa3fbb615267ff.zip |
stepcompress: Encourage add=0 in compress_bisect_add()
Only use a non-zero 'add' if it actually extends the number of steps
the command covers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/stepcompress.c')
-rw-r--r-- | klippy/stepcompress.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/klippy/stepcompress.c b/klippy/stepcompress.c index 643e0083..b29382c9 100644 --- a/klippy/stepcompress.c +++ b/klippy/stepcompress.c @@ -130,7 +130,7 @@ compress_bisect_add(struct stepcompress *sc) struct points point = minmax_point(sc, sc->queue_pos); int32_t outer_mininterval = point.minp, outer_maxinterval = point.maxp; int32_t add = 0, minadd = -0x8001, maxadd = 0x8000; - int32_t bestinterval = 0, bestcount = 1, bestadd = 0, bestreach = INT32_MIN; + int32_t bestinterval = 0, bestcount = 1, bestadd = 1, bestreach = INT32_MIN; int32_t checked_count = 0; for (;;) { @@ -162,7 +162,7 @@ compress_bisect_add(struct stepcompress *sc) // Check if this is the best sequence found so far int32_t reach = add*(addfactor-count) + maxinterval*count; - if (reach > bestreach) { + if (reach > bestreach && (bestadd || count > bestcount + bestcount/16)) { bestinterval = maxinterval; bestcount = count; bestadd = add; |