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