any number
the next power of two after val
assert(nextPow2(2) == 4); assert(nextPow2(10) == 16); assert(nextPow2(4000) == 4096); assert(nextPow2(-2) == -4); assert(nextPow2(-10) == -16); assert(nextPow2(uint.max) == 0); assert(nextPow2(uint.min) == 0); assert(nextPow2(size_t.max) == 0); assert(nextPow2(size_t.min) == 0); assert(nextPow2(int.max) == 0); assert(nextPow2(int.min) == 0); assert(nextPow2(long.max) == 0); assert(nextPow2(long.min) == 0);
assert(nextPow2(2.1) == 4.0); assert(nextPow2(-2.0) == -4.0); assert(nextPow2(0.25) == 0.5); assert(nextPow2(-4.0) == -8.0); assert(nextPow2(double.max) == 0.0); assert(nextPow2(double.infinity) == double.infinity);
Gives the next power of two after val. T can be any built-in numerical type.
If the operation would lead to an over/underflow, this function will return 0.