Re: [PATCH] lib/int_sqrt.c: Optimize square root function
From: Peter Zijlstra
Date: Thu Jul 20 2017 - 10:13:49 EST
On Thu, Jul 20, 2017 at 04:52:49AM -0700, Joe Perches wrote:
> On Thu, 2017-07-20 at 13:24 +0200, Peter Zijlstra wrote:
> []
> > + m = 1UL << ((fls(x) + 1) & ~1UL);
>
> maybe
>
> #if BITS_PER_LONG == 64
> m = 1UL << ((fls64(x) + 1) & ~1UL);
> #else
> m = 1UL << ((fls(x) + 1) & ~1UL);
> #endif
We do seem to have __fls() which is defined on long.