def utf8.need
import cswap-bend-cli@0.1.0.0/b64.bend as B64import Base
51# The decoder state is (need, cp): continuation bytes still due and the code
52# point so far. These three give the next need, the next cp, and whether cp
53# is complete.
54def utf8.need(+b: U32, +need: U32) -> U32:
55 sel(U32.is_eq(need, 0), utf8.len(b), (need - 1 : U32))