adc static method
Add-with-carry: a + b + carry. Returns (result, carryOut) where
carryOut is the numeric carry (0, 1, or 2 — matches Rust's adc,
which accepts a full-width carry-in from a preceding mac).
Implementation
static (Uint64 result, Uint64 carryOut) adc(
Uint64 a,
Uint64 b,
Uint64 carry,
) {
final s1 = a + b;
final c1 = s1 < a ? Uint64.one : Uint64.zero;
final s2 = s1 + carry;
final c2 = s2 < s1 ? Uint64.one : Uint64.zero;
return (s2, c1 + c2);
}