Const bits

uint

Type T

type T = uint

Function div_ceil

fn div_ceil(x: uint, y: uint) -> uint

Divide two numbers, return the result, rounded up.

Arguments

Return value

The smallest integer q such that x/y <= q.

Function 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.

Arguments

Return value

The smallest integer q such that x/y <= q. This is either x/y or x/y + 1.

Function div_round

fn div_round(x: uint, y: uint) -> uint

Divide two numbers, return the result, rounded to the closest integer.

Arguments

Return value

The integer q closest to x/y.

Function iterate

fn iterate(lo: uint, hi: uint, it: &fn(uint) -> bool) -> bool

Iterate over the range [lo..hi), or stop when requested

Arguments

Return value

true If execution proceeded correctly, false if it was interrupted, that is if it returned false at any point.

Function next_power_of_two

fn next_power_of_two(n: uint) -> uint

Returns the smallest power of 2 greater than or equal to n