def carry

bend-collections@1.0.0.0 · src/crypto/curve25519/field.bend:97

import bend-collections@1.0.0.0/src/crypto/curve25519/field.bend as Field
import Base

97# one carry pass: limbs below 2^8 and the carry out of the top limb
98def carry(xs: List<&2, U32>, c: U32) -> Cr:
99  match xs:
100    case Nil{}:
101      Cr{Nil{}, c}
102    case Con{h, t}:
103      +s = U32.add(h, c)
104      carry_con(U32.mod(s, 256), carry(t, U32.div(s, 256)))

Uses (7)

Used by (6)