[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdmN2==9tG0fxRO8K-eAJudeemaKUuhJEAuGHc=P8GpGwA@mail.gmail.com>
Date: Thu, 10 Nov 2022 11:01:02 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: x86@...nel.org, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, Yury Norov <yury.norov@...il.com>,
llvm@...ts.linux.dev, Borislav Petkov <bp@...e.de>
Subject: Re: [PATCH v1 2/2] x86/asm/bitops: Use __builtin_clz*() to evaluate
constant expressions
On Sun, Nov 6, 2022 at 1:51 AM Vincent Mailhol
<mailhol.vincent@...adoo.fr> wrote:
>
> #ifdef CONFIG_X86_64
> -static __always_inline int fls64(__u64 x)
> +static __always_inline int constant_fls64(u64 x)
> +{
> + BUILD_BUG_ON(sizeof(unsigned long long) != sizeof(x));
Thanks for the patches! They LGTM; but why do we need this BUILD_BUG_ON here?
> +
> + if (!x)
> + return 0;
> +
> + return BITS_PER_TYPE(x) - __builtin_clzll(x);
> +}
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists