stepcompress: Prefer greater interval if all else equal

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-12-18 22:11:20 -05:00
parent 19d1f83d97
commit 1d841eeb87
1 changed files with 2 additions and 1 deletions

View File

@ -164,7 +164,8 @@ compress_bisect_add(struct stepcompress *sc)
// Check if this is the best sequence found so far
int32_t count = nextcount - 1, addfactor = count*(count-1)/2;
int32_t reach = add*addfactor + interval*count;
if (reach > bestreach) {
if (reach > bestreach
|| (reach == bestreach && interval > bestinterval)) {
bestinterval = interval;
bestcount = count;
bestadd = add;