On 15.03.2024 19:06, Oleksii Kurochko wrote: > Return type was left 'int' because of the following compilation error: > > ./include/xen/kernel.h:18:21: error: comparison of distinct pointer types > lacks a cast [-Werror] > 18 | (void) (&_x == &_y); \ > | ^~ > common/page_alloc.c:1843:34: note: in expansion of macro 'min' > 1843 | unsigned int inc_order = min(MAX_ORDER, flsl(e - s) - 1); > > generic_fls{l} was used instead of __builtin_clz{l}(x) as if x is 0, > the result in undefined. > > Signed-off-by: Oleksii Kurochko <oleksii.kuroc...@gmail.com>
Assuming Andrew's pending change goes in as posted, I'm okay with this to (as simply following suit). Without that having happened, I can't very well offer an ack here. Just one nit: > --- a/xen/include/xen/bitops.h > +++ b/xen/include/xen/bitops.h > @@ -69,6 +69,30 @@ static inline int generic_flsl(unsigned long x) > > #include <asm/bitops.h> > > +static always_inline __pure int fls(unsigned int x) > +{ > + if (__builtin_constant_p(x)) Style (missing blanks immediately inside the parentheses), also again ... > + return generic_fls(x); > + > +#ifndef arch_fls > +#define arch_fls generic_fls > +#endif > + > + return arch_fls(x); > +} > + > +static always_inline __pure int flsl(unsigned long x) > +{ > + if (__builtin_constant_p(x)) ... here. Jan