Add with carry (source code)

= Add with carry

For $n$-bit operands, an <add with carry> operation forms $X+Y+C_{\rm in}$, retains its residue <modulo> $2^n$, and outputs its <arithmetic carry>. Adding low limbs first and feeding each <arithmetic carry> into the next limb implements multiword unsigned addition. With $M=2^n$, the identities $X_0+Y_0=Z_0+Mc$ and $X_1+Y_1+c=Z_1+Md$ combine into $(MX_1+X_0)+(MY_1+Y_0)=MZ_1+Z_0+M^2d$.<Thumb 16-bit instruction set quick reference by Arm>[Page 1, Add with carry]{ref}