SI-7968 Use an intrinsic for the next power of two calculation.

Fixes issues raised in #3126.
The nextPowerOfTwo function is replaced by nextPositivePowerOfTwo which provides the following improvements:

1) Uses the Integer.numberOfLeadingZeros intrinsic for the actual implementation.
2) If the input is already a power of two it just returns the number instead of returning the next power of two.
3) Works for negative numbers and zero as input. The output is 1 in both cases.