]> git.ozlabs.org Git - ccan/blobdiff - ccan/tally/tally.c
tally: Adapt bucket_range to Samba coding conventions
[ccan] / ccan / tally / tally.c
index 5602e75017055ae5ce20f71deaf4c80f2db55784..936b5142561a9ec172fd86a96ddf88a529472842 100644 (file)
@@ -322,8 +322,9 @@ static int64_t divls64(int64_t u1, uint64_t u0, int64_t v)
 ssize_t tally_mean(const struct tally *tally)
 {
        size_t count = tally_num(tally);
-       if (!count)
+       if (!count) {
                return 0;
+       }
 
        if (sizeof(tally->total[0]) == sizeof(uint32_t)) {
                /* Use standard 64-bit arithmetic. */
@@ -366,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;