Pudu programming language
Menu
API reference

Std.Bits.nextPowerOfTwo

1 declaration

fn

nextPowerOfTwo: &T -> T where T: Bits

This is a callable function.

What it does

The smallest power of two that is not below the value.

A value at or below one answers with one, the smallest power of two there

is. A value whose next power does not fit the type answers with the largest

power that does, because there is no other value it could name.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.
  • & borrows a value for this call instead of moving or copying it.

Back to Std.BitsSearch related declarations