def utf8.cont.in
import bend-kit-encoding@0.5.0.0/encoding.bend as Encodingimport Base
108# WHATWG: a byte that breaks a sequence yields U+FFFD and is read again as a lead.
109def utf8.cont.in(+need: U32, cp: U32, +b: U32, out: String, ok: Bool) -> Utf8:
110 match ok:
111 case True{}:
112 utf8.more((need - 1 : U32), (cp * 64 + U32.and(b, 63) : U32), out, U32.is_eq(need, 1))
113 case False{}:
114 utf8.lead(b, utf8.bad(out), U32.is_lt(b, 128))