MCPcopy
hub / github.com/buger/jsonparser / h2I

Function h2I

escape.go:24–34  ·  view source on GitHub ↗
(c byte)

Source from the content-addressed store, hash-verified

22const badHex = -1
23
24func h2I(c byte) int {
25 switch {
26 case c >= '0' && c <= '9':
27 return int(c - '0')
28 case c >= 'A' && c <= 'F':
29 return int(c - 'A' + 10)
30 case c >= 'a' && c <= 'f':
31 return int(c - 'a' + 10)
32 }
33 return badHex
34}
35
36// decodeSingleUnicodeEscape decodes a single \uXXXX escape sequence. The prefix \u is assumed to be present and
37// is not checked.

Callers 2

TestH2IFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestH2IFunction · 0.68