def add
import bend-collections@1.0.0.0/src/crypto/sha512/core.bend as Coreimport Base
import bend-collections@1.0.0.0/src/crypto/sha512/types.bend as T
18# (a + b) mod 2^64: the carry out of the low halves is 1 exactly when their
19# wrapped sum is below an addend.
20def add(a: T.Lane, b: T.Lane) -> T.Lane:
21 match a b:
22 case T.W{ah, +al} T.W{bh, bl}:
23 +lo = U32.add(al, bl)
24 T.W{U32.add(U32.add(ah, bh), Bool.to_u32(U32.is_lt(lo, al))), lo}