search for: round_

Displaying 2 results from an estimated 2 matches for "round_".

Did you mean: round
2018 Sep 17
1
Re: [PATCH nbdkit v2] common: Introduce round up, down; and divide round up functions.
...| 2 +- > filters/cow/Makefile.am | 3 +- > filters/cow/cow.c | 2 +- > filters/truncate/truncate.c | 5 ++-- > 6 files changed, 68 insertions(+), 6 deletions(-) > > +/* Round up i to next multiple of n (n must be a power of 2). > + */ > +#define ROUND_UP(i, n) ({ \ > + assert (is_power_of_2 (n)); \ > + ((i) + (n) - 1) & ~((n) - 1); \ > +}) Potential bug: if n is 32-bit unsigned, but i is 64-bit, the bitmask on the right half of & will be inappropriately truncate...
2018 Sep 17
2
[PATCH nbdkit v2] common: Introduce round up, down; and divide round
Since we're using ({ .. }) gcc/clang extension, let's rewrite the rounding.h change too. Rich.