def utf8.cont
mylsm-lsm-store@0.6.0.1 · src/StorageBytes.bend:28
import mylsm-lsm-store@0.6.0.1/src/StorageBytes.bend as StorageBytes
import Base
28def utf8.cont(+need: U32, cp: U32, +out: String, ok: Bool, in_range: Bool, byte: U32) -> Utf8State:
29 match in_range:
30 case True{}:
31 +next_cp = (cp * 64 + U32.and(byte, 63) : U32)
32 Utf8State{(need - 1 : U32), 128, 191, next_cp,
33 Bool.pick(String, U32.is_eq(need, 1), SCon{Chr{next_cp}, out}, out), ok}
34 case False{}:
35 Utf8State{0, 128, 191, 0, out, False{}}