3 ms·
This is not only about optimisation, but often it provides you the idiom for coding something. E.g.: 'is x a power of two'? How to write this in a programming
by beeforpork 4y ago
This is not only about optimisation, but often it provides you the idiom for coding something.
E.g.: 'is x a power of two'? How to write this in a programming language? However unoptimised: how to actually code this test?
HD tells you the idiom: (x & (x-1)) == 0, for any x != 0.