def add

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/blake/blake2b.bend:19

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/blake/blake2b.bend as Blake2b
import Base
import bend-collections-laws-crypto@1.0.0.0/src/crypto/blake/blake2b/types.bend as T

19# (a + b) mod 2^64: the low halves add modulo 2^32; the high halves add the
20# carry out of the low half, which is 1 exactly when the low sum wrapped.
21def add(a: T.Lane, b: T.Lane) -> T.Lane:
22  match a b:
23    case T.W{+al,ah} T.W{bl,bh}:
24      +lo = U32.add(al,bl)
25      T.W{lo,U32.add(U32.add(ah,bh),Bool.to_u32(U32.is_lt(lo,al)))}

Uses (4)

Used by (2)