tenko icon indicating copy to clipboard operation
tenko copied to clipboard

Use `&~x` rather than `|x^x` to clear one or more bits

Open pvdz opened this issue 4 years ago • 1 comments

Kinda makes more sense although it probably doesn't matter much for performance.

const x = 33;
log(33 | 32 ^ 32);
log(33 & ~32);

pvdz avatar May 18 '21 23:05 pvdz

I think it's faster if you 'shift' either left or right. It will improve perf if you are going to unset lots of bits.

KFlash avatar May 24 '21 22:05 KFlash