[PATCH] bitops: use safer link explaining the algorithm
Rasmus Villemoes
linux at rasmusvillemoes.dk
Sun Jan 26 12:16:35 PST 2025
On Sun, 26 Jan 2025 at 18:46, Yury Norov <yury.norov at gmail.com> wrote:
>
> >
> > > */
> > > val ^= val >> 4;
> > > return (0x6996 >> (val & 0xf)) & 1;
> >
>
> If you guys feel that you can explain the algorithm you're employing
> in a half-VGA-screen comment, it would be the best choice, and that's
> enough.
So when I saw this, I even wondered why it needed a comment or
reference at all. I thought table-in-a-constant was a standard trick
everybody knows.
Isn't "The constant 0x6996 has bits set in exactly the positions
corresponding to four-bit numbers with odd parity." enough?
Rasmus
More information about the linux-i3c
mailing list