Checking if an Integer is an Exact Binary Power
Temtaime via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 26 10:20:53 PDT 2016
On Tuesday, 26 April 2016 at 16:53:00 UTC, tsbockman wrote:
> On Tuesday, 26 April 2016 at 14:37:46 UTC, Marco Leise wrote:
>> Can we just use __traits(hasTargetFeature, "popcnt") already
>> and get rid of _popcnt?
>
> No, because DMD does not currently support setting SSE4 as the
> minimum target. Thus, `__traits(hasTargetFeature, "popcnt")`
> must always return `false` at compile time.
>
> As for LDC and GDC - both already treat `popcnt()` as an
> intrinsic, and don't need your proposed change.
It's strange why it emits an branch.
http://goo.gl/jJbSYd
Det version doesn't use cmp and should be fast.
More information about the Digitalmars-d
mailing list