def hex.of

emerging-ezhttp@0.21.0.0 · src/http.bend:67

import emerging-ezhttp@0.21.0.0/src/http.bend as Http
import Base

67# the value of one hex digit's code point, or 16 when it is not one
68def hex.of(+u: U32) -> U32:
69  Bool.pick(U32, Bool.and(U32.is_ge(u, 48), U32.is_le(u, 57)), U32.sub(u, 48),
70    Bool.pick(U32, Bool.and(U32.is_ge(u, 97), U32.is_le(u, 102)), U32.sub(u, 87),
71      Bool.pick(U32, Bool.and(U32.is_ge(u, 65), U32.is_le(u, 70)), U32.sub(u, 55),
72        16)))

Uses (6)

Used by (1)