#how to do an add with carry chain?
1 messages · Page 1 of 1 (latest)
conceptually, it does an addOverflow with a + b + c. So you can do the following and the compiler should figure it out:
addOverflowCarry(a, b, carry):
out, c1 = addOverflow(a, b)
out, c2 = addOverflow(out, carry)
return out, c1 or c2
Unfortunately, zig seems to have poor LLVM codegen here, even if clang/gcc figure it out: https://godbolt.org/z/6f3Ef3EK9