def append
import lawful-bytes@0.1.1.0/fast.bend as Fastimport Base
import lawful-bytes@0.1.1.0/defs.bend as D
import lawful-bytes@0.1.1.0/bytes.bend as B
138# dst with bytes s .. s+n-1 of src added at the end; src handed back. The
139# first bytes, up to dst's next word boundary, go one at a time, the rest a
140# word at a time.
141def append(dst: D.Bytes, src: D.Bytes, +s: U32, +n: U32) -> D.Bytes & D.Bytes:
142 D.Bytes{+dl, db} = dst
143 +h = U32.min(((4 - (dl .&. 3 : U32) : U32) .&. 3 : U32), n)
144 append.k((n - h : U32), (s + h : U32), B.append(D.Bytes{dl, db}, src, s, h))