Module sp_runtime::helpers_128bit[][src]

Re-export 128 bit helpers. Some helper functions to work with 128bit numbers. Note that the functionality provided here is only sensible to use with 128bit numbers because for smaller sizes, you can always rely on assumptions of a bigger type (u128) being available, or simply create a per-thing and use the multiplication implementation provided there.

Functions

gcd

Helper gcd function used in Rational128 implementation.

multiply_by_rational

Safely and accurately compute a * b / c. The approach is:

split

split a u128 into two u64 limbs

to_big_uint

Convert a u128 to a u32 based biguint.