On 05.07.2025 16:27, Koichiro Den wrote: > --- a/xen/include/xen/macros.h > +++ b/xen/include/xen/macros.h > @@ -5,6 +5,7 @@ > #define ROUNDDOWN(x, a) ((x) & ~((a) - 1)) > > #define IS_ALIGNED(val, align) (!((val) & ((align) - 1))) > +#define IS_POWER_OF_TWO(val) ((val) && !((val) & ((val) - 1))) > > #define DIV_ROUND(n, d) (((n) + (d) / 2) / (d)) > #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
I understand surrounding code has similar issues, but I wonder if we wouldn't be better off requiring additions to this file to be clean towards arbitrary use of the macros. That is in particular to make sure macro arguments are evaluated exactly once. REST maintainers in particular - thoughts? Jan