def utf8.code
import gralha-http-core@0.1.0.0/http.bend as Httpimport Base
89def utf8.code(+b: U32, +need: U32, +code: U32) -> U32:
90 when(U32, U32.is_eq(need, 0),
91 _ => when(U32, U32.is_ge(b, 240), _ => (b .&. 7 : U32), _ => when(U32, U32.is_ge(b, 224),
92 _ => (b .&. 15 : U32), _ => (b .&. 31 : U32))),
93 _ => ((code << 6n) .|. (b .&. 63) : U32))