Efficient 128-bit addition using carry flag

Actually gcc will use the carry automatically if you write your code carefully… Current GCC can optimize hiWord += (loWord < loAdd); into add/adc (x86’s add-with-carry). This optimization was introduced in GCC5.3. With separate uint64_t chunks in 64-bit mode: https://godbolt.org/z/S2kGRz. And the same thing in 32-bit mode with uint32_t chunks: https://godbolt.org/z/9FC9vc (editor’s note: Of course … Read more