On 23 April 2016 at 15:56, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
> On 4/23/16 9:54 AM, Andrei Alexandrescu wrote:
>>
>> 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
>
>
> Oh, and the bummer is that on gdc it's a function call:
> https://godbolt.org/g/dEYCcG -- Andrei
>

That can easily be changed. ;-)

Reply via email to