On Tue, May 07, 2024 at 01:25:22PM +0300, Ilpo J?rvinen wrote:
> Calculations related to bridge window size contain literal 20 that is
> the minimum alignment for a bridge window. Make the code more obvious
> by converting the literal 20 to __ffs(SZ_1MB).
..
> - align1 <<= (order + 20);
> + align1 <<= (order + __ffs(SZ_1M));
No need for outer parentheses.
..
> + order = __ffs(align) - __ffs(SZ_1M);
Yeah, would be nice to have something like
#define bit_distance(a, b) (ffs(a) - fls(b))
in bitops.h as we have a few users and I have heard about one more coming,
but this is topic to another discussion. (Yuri, just FYI.)
--
With Best Regards,
Andy Shevchenko