-
-
Notifications
You must be signed in to change notification settings - Fork 18
next_pow2
Vašek edited this page Feb 5, 2019
·
1 revision
This function returns the smallest power of two that is greater than or equal to the given number
next_pow2(n)
Argument | Description |
---|---|
int n |
The given number |
Returns: int
This function returns the smallest power of two that is greater than or equal to the given n
number.
int value = next_pow2(128);
128 is already power of 2 - this function will set value
to 128.
int value = next_pow2(300);
Nearest power of two that is higher than 300 is 512 - this function will set value
to 512.
Back to number_functions