On Thu, May 26, 2022 at 8:41 PM Roger Sayle wrote:
>
>
> A common idiom for testing if a specific set of bits is set in a value
> is to use "(X & Y) == Y", which on x86 results in an AND followed by a
> CMP. A slightly improved implementation is to instead use (~X & Y)==0,
> that uses a NOT and a
A common idiom for testing if a specific set of bits is set in a value
is to use "(X & Y) == Y", which on x86 results in an AND followed by a
CMP. A slightly improved implementation is to instead use (~X & Y)==0,
that uses a NOT and a TEST (or ANDN where available); still two "fast"
instructions,