bits
T
div_ceil
- Divide two numbers, return the result, rounded up.div_floor
- Divide two numbers, return the result, rounded down.div_round
- Divide two numbers, return the result, rounded to the closest integer.iterate
- Iterate over the range [lo
..hi
), or stop when requestednext_power_of_two
- Returns the smallest power of 2 greater than or equal to n
bits
uint
T
type T = uint
div_ceil
fn div_ceil(x: uint, y: uint) -> uint
Divide two numbers, return the result, rounded up.
The smallest integer q
such that x/y <= q
.
div_floor
fn div_floor(x: uint, y: uint) -> uint
Divide two numbers, return the result, rounded down.
Note: This is the same function as div
.
The smallest integer q
such that x/y <= q
. This is either x/y
or x/y + 1
.
div_round
fn div_round(x: uint, y: uint) -> uint
Divide two numbers, return the result, rounded to the closest integer.
The integer q
closest to x/y
.
iterate
fn iterate(lo: uint, hi: uint, it: &fn(uint) -> bool) -> bool
Iterate over the range [lo
..hi
), or stop when requested
true
to continue, false
to stop.true
If execution proceeded correctly, false
if it was interrupted, that is if it
returned false
at any point.
next_power_of_two
fn next_power_of_two(n: uint) -> uint
Returns the smallest power of 2 greater than or equal to n