Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

next_pow2

Vašek edited this page Feb 5, 2019 · 1 revision

next_pow2

This function returns the smallest power of two that is greater than or equal to the given number

Syntax:

next_pow2(n)
Argument Description
int n The given number

Returns: int

Description:

This function returns the smallest power of two that is greater than or equal to the given n number.

Example:

int value = next_pow2(128);

128 is already power of 2 - this function will set value to 128.

Example 2:

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

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /