core: simplify code, add asserts, remove undefined behavior around int64x64-128.
Fix an overflow bug inUmulByInvert()whereresultcan differ by2^64from intended.Add asserts to detect overflows inUmul()andUmulByInvert().
This is related to !1010 (closed).
- Add asserts to detect overflows in
Mul(),Umul()to ensure the number's product can be represented byint64x64_t - Add an assert in
UmulByInvert()to checkbcame fromInvert() - Fix undefined behavior when negating the smallest signed integer in
output_sign()andMulByInvert() - Improve documentation in the code
Edited by Tolik Zinovyev