Skip to content

intx 0.16.0

Latest

Choose a tag to compare

@chfast chfast released this 23 Nov 13:48
· 1 commit to main since this release
v0.16.0
6d7ecb4

Added

  • Add sint<N>, the N-bit two's complement signed integer, with the int128 and int256 aliases. It converts to and from uint<M> of any width and gives access to its words. #368 #483 #484
  • Add smul(), the signed multiplication 64 x 64 → 128. #451
  • Add mac(), the 64-bit multiply-accumulate a + x * y + c. #445
  • Add the funnel shifts fshl() and fshr(), and the shifts shl() and shr() of word spans. #376
  • Add ++, -- and unary + to uint<N> and sint<N>. #488
  • Add <, <=, > and >= for uint<N> and builtin integers. #491
  • Add <<= and >>= for builtin integer shift amounts. #463
  • Add the INTX_ASSERTIONS CMake option, which keeps assert() and INTX_REQUIRE() in release builds. #493

Changed

  • A division by 0 gives 0 as the quotient and the remainder, as in the EVM: udivrem(), sdivrem(), / and %, and addmod() and mulmod() with the modulus 0. #435
  • A negative builtin integer shift amount fails an assertion and constant evaluation in debug builds. Release builds still give 0. #463
  • Optimize the division (udivrem(), /, %, addmod() and mulmod()):
  • Optimize to_string() and hex(). #390 #391 #392
  • Optimize the uint256 multiplication and submul(). #427 #460 #461
  • Optimize the uint256 less-than, slt() and the sign handling of sdivrem(). #434 #453 #458
  • With GCC, use the builtin 128-bit type for the uint128 addition and subtraction, and SHLD/SHRD for fshl() and fshr() on x86-64. #374 #379
  • Add int128 values with the builtin 128-bit type. #487
  • Optimize be::store() and be::trunc(). #452 #457
  • With MSVC, force-inline unreachable() so that INTX_REQUIRE() is a hint in release builds, and compute the portable addc() and subc() without branches. #403 #410

Removed

  • Remove fast_add(). Use the uint128 addition. #393

Fixed

  • Fix the truncation of __int128 and unsigned __int128 values in the uint constructors, assignments and conversions. The other integer types wider than 64 bits, e.g. _BitInt(128), no longer convert to uint. #462
  • Fix the overflow check in from_string(), which missed most overflows of the decimal digits. Leading zeros no longer cause std::out_of_range. #432
  • Do not define __has_feature for the compilers without it. #450
  • Fix configuring the tests with CMake 4.5. #454