Checking if an Integer is an Exact Binary Power
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 25 12:36:10 PDT 2016
On 04/25/2016 03:21 PM, Solomon E wrote:
> There are other parts in isPow2F where I'm not sure exactly what the
> bits are doing, such as how the compiler makes the result negative
I suggest you simply consider x unsigned. There is no value to the
discussion brought by negative numbers, and implementation-wise you can
insert a cast or let the overload mechanism only use unsigned integers.
-- Andrei
More information about the Digitalmars-d
mailing list