Module sp_runtime::helpers_128bit
source · [−]Expand description
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
Helper gcd function used in Rational128 implementation.
Safely and accurately compute a * b / c
. The approach is:
split a u128 into two u64 limbs
Convert a u128 to a u32 based biguint.