[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v5 04/23] xen/asm-generic: introduce generic fls() and flsl() functions
On Thu, 2024-02-29 at 16:25 +0000, Andrew Cooper wrote: > On 26/02/2024 5:38 pm, Oleksii Kurochko wrote: > > These functions can be useful for architectures that don't > > have corresponding arch-specific instructions. > > > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> > > --- > > Changes in V5: > > - new patch > > --- > > xen/include/asm-generic/bitops/fls.h | 18 ++++++++++++++++++ > > xen/include/asm-generic/bitops/flsl.h | 10 ++++++++++ > > 2 files changed, 28 insertions(+) > > create mode 100644 xen/include/asm-generic/bitops/fls.h > > create mode 100644 xen/include/asm-generic/bitops/flsl.h > > > > diff --git a/xen/include/asm-generic/bitops/fls.h > > b/xen/include/asm-generic/bitops/fls.h > > new file mode 100644 > > index 0000000000..369a4c790c > > --- /dev/null > > +++ b/xen/include/asm-generic/bitops/fls.h > > @@ -0,0 +1,18 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#ifndef _ASM_GENERIC_BITOPS_FLS_H_ > > +#define _ASM_GENERIC_BITOPS_FLS_H_ > > + > > +/** > > + * fls - find last (most-significant) bit set > > + * @x: the word to search > > + * > > + * This is defined the same way as ffs. > > + * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. > > + */ > > + > > +static inline int fls(unsigned int x) > > +{ > > + return generic_fls(x); > > +} > > + > > +#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */ > > diff --git a/xen/include/asm-generic/bitops/flsl.h > > b/xen/include/asm-generic/bitops/flsl.h > > new file mode 100644 > > index 0000000000..d0a2e9c729 > > --- /dev/null > > +++ b/xen/include/asm-generic/bitops/flsl.h > > @@ -0,0 +1,10 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#ifndef _ASM_GENERIC_BITOPS_FLSL_H_ > > +#define _ASM_GENERIC_BITOPS_FLSL_H_ > > + > > +static inline int flsl(unsigned long x) > > +{ > > + return generic_flsl(x); > > +} > > + > > +#endif /* _ASM_GENERIC_BITOPS_FLSL_H_ */ > > Please don't do this. It's compounding existing problems we have > with > bitops, and there's a way to simplify things instead. > > If you can wait a couple of days, I'll see about finishing and > posting > my prototype demonstrating a simplification across all architectures, > and a reduction of code overall. Please add me in CC. ~ Oleksii
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |