diff options
Diffstat (limited to 'lib/ccan/tally')
-rw-r--r-- | lib/ccan/tally/tally.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ccan/tally/tally.c b/lib/ccan/tally/tally.c index e166dd03c5..936b514256 100644 --- a/lib/ccan/tally/tally.c +++ b/lib/ccan/tally/tally.c @@ -367,10 +367,11 @@ static ssize_t bucket_range(const struct tally *tally, unsigned b, size_t *err) ssize_t min, max; min = bucket_min(tally->min, tally->step_bits, b); - if (b == tally->buckets - 1) + if (b == tally->buckets - 1) { max = tally->max; - else + } else { max = bucket_min(tally->min, tally->step_bits, b+1) - 1; + } /* FIXME: Think harder about cumulative error; is this enough?. */ *err = (max - min + 1) / 2; |