On Sunday, 24 April 2016 at 23:00:56 UTC, Temtaime wrote:
Please no cmp. Just bool isPowerOf2(uint x) { return x && !(x & (x - 1)); }
You do realise that this will (typically) emit a branch? — David
David Nadlinger via Digitalmars-d Sun, 24 Apr 2016 16:20:56 -0700
On Sunday, 24 April 2016 at 23:00:56 UTC, Temtaime wrote:
Please no cmp. Just bool isPowerOf2(uint x) { return x && !(x & (x - 1)); }
You do realise that this will (typically) emit a branch? — David