TempAlloc review starts now

bearophile bearophileHUGS at lycos.com
Mon Jun 6 04:38:37 PDT 2011


simendsjo:

> bool isPowerOf(int pow, int num) {
...
> static assert(isPowerOf(2, alignBytes), "getAligned requires alignBytes to be a power of 2")

I suggest to add something related to this to std.math instead:

bool isPow2(long x) {
    return (x < 1L) ? false : !(x & (x-1L));
}

A similar template is OK too.

Bye,
bearophile


More information about the Digitalmars-d mailing list