def u.class
import bend-kit-json@0.7.0.0/json.bend as Jsonimport Base
331# 0: not four hex digits; 1: high surrogate; 2: low surrogate; 3: other.
332def u.class(+v: U32) -> U32:
333 Bool.pick(U32, U32.is_eq(v, 65536), 0, Bool.pick(U32, is_hi(v), 1, Bool.pick(U32, is_lo(v), 2, 3)))