Module sp_arithmetic::helpers_128bit
source · Expand description
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.
- Returns
a * b / c
(wrapping to 128 bits) orNone
in the case of overflow. - split a u128 into two u64 limbs
- Convert a u128 to a u32 based biguint.