On 4/23/16 9:06 AM, Vladimir Panteleev wrote:
On Saturday, 23 April 2016 at 13:04:00 UTC, Nordlöw wrote:Wanted: CT-trait and run-time predicate for checking whether its single integer parameter is an exact power of two.popcnt(x) <= 1 ?
Would be interesting to see how it compares to the handwritten version on different machines. popcnt has a reputation of being slow in older CPUs, in recent ones it has a latency of 3 cycles and a throughput of 1 cycle. -- Andrei