Skip to content

Added a 128-bit big integer for emulating int128_t for 32-bit platforms

Summary

This is a completely optional commit. It might just be too much busy code.

However, if it is accepted, the !1782 (merged) MR will be updated to use this commit.

This adds the type arith_uint128 which is a lot like arith_uint256, leveraging the same templates, but only uses 128 bits. This is an optional commit intended as perhaps an optimization for code in the future that will need to work with uint128_t but it is lacking on the CPU architecture (arm32). In particular, in the ABLA EBAA work, this line of code here is now using arith_uint256 for platforms that lack __int128, but this type is overkill and a smaller, more compact arith_uint128 would be slightly faster here.

Unit tests were copied over from arith_uint256_tests -> arith_uint128_tests and were adapted.

Note that this commit also refactors arith_uint256 (and its base template class base_uint<BITS>) slightly to be more re-usable. The existing code couldn't really support anything other than uint256.

Test Plan

  • Review
  • ninja all check-all
Edited by Calin Culianu

Merge request reports