4 ms·
> if (x & (1<<n)) { > n-th bit is set Yeah, don't get a habit to do that. Instead: if ((x >> n) & 1) if x is wider type that int or n, the result of (1
by 112233 8y ago
> if (x & (1<<n)) {
> n-th bit is set
Yeah, don't get a habit to do that. Instead:
if ((x >> n) & 1)
if x is wider type that int or n, the result of (1<<n) may be UB, and in practice the generated code will be buggy.