def hexval
import bend-kit-netip@0.1.0.0/netip.bend as Netipimport Base
9# A hex digit's value, or 16 when c is not one.
10def hexval(+c: U32) -> U32:
11 Bool.pick(U32, Bool.and(U32.is_le(48, c), U32.is_le(c, 57)), (c - 48 : U32),
12 Bool.pick(U32, Bool.and(U32.is_le(97, c), U32.is_le(c, 102)), (c - 87 : U32),
13 Bool.pick(U32, Bool.and(U32.is_le(65, c), U32.is_le(c, 70)), (c - 55 : U32), 16)))