::std::num::

Function zext

pub extern fn zext<#uint N, #uint M>(x: uint<N>) -> uint<M>
where
M >= N else "Zero-extend result must be wider than the input value",
Expand

Increases the size of an unsigned integer by extending it with zeros on the most significant side.

This operation preserves the numeric value.

Examples

assert zext(9u8) == 9u8;
assert zext(9u8) == 9u12;
assert zext(0u8) == 0u32;