On 25.01.21 13:00, Andrea Bastoni wrote: > Signed-off-by: Andrea Bastoni <[email protected]> > --- > hypervisor/arch/arm-common/include/asm/bitops.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/hypervisor/arch/arm-common/include/asm/bitops.h > b/hypervisor/arch/arm-common/include/asm/bitops.h > index 808c9a0f..a726862f 100644 > --- a/hypervisor/arch/arm-common/include/asm/bitops.h > +++ b/hypervisor/arch/arm-common/include/asm/bitops.h > @@ -31,6 +31,7 @@ static inline unsigned long clz(unsigned long word) > /* Returns the position of the least significant 1, MSB=31, LSB=0*/ > static inline unsigned long ffsl(unsigned long word) > { > + // FIXME: the ffsl on x86 isn't robust. > if (!word) > return 0; > asm volatile ("rbit %0, %0" : "+r" (word)); > @@ -41,3 +42,12 @@ static inline unsigned long ffzl(unsigned long word) > { > return ffsl(~word); > } > + > +static inline unsigned long msbl(unsigned long word) > +{ > +#if BITS_PER_LONG == 64 > + return 63 - clz(word); > +#else > + return 32 - clz(word);
31? Something's fishy here. Jan > +#endif > +} > -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/4b9466ce-3886-d080-dc41-e667e4e2439d%40siemens.com.
