def cr.vm.add
import bend-osdev-crypto@0.1.0.0/vmac.bend as Vmacimport Base
import bend-osdev-word64@0.1.0.0/word64.bend as W
50# a + b mod 2^128
51def cr.vm.add(a: CrU128, b: CrU128) -> CrU128:
52 match a b:
53 case CrU128{ah, +al} CrU128{bh, bl}:
54 +lo = W.W64.add(al, bl)
55 CrU128{W.W64.add(W.W64.add(ah, bh), cr.vm.carry(W.W64.is_lt(lo, al))), lo}