MCPcopy Create free account
hub / github.com/buger/jsonparser / h2I

Function h2I

escape.go:65–76  ·  view source on GitHub ↗

reqproof:lemma h2I_range func(c byte) bool { r := h2I(c) return r == -1 || (r >= 0 && r <= 15) } reqproof:lemma h2I_decimal_digit func(c byte) bool { if c < '0' || c > '9' { return true } r := h2I(c) return r >= 0 && r <= 9 } reqproof:lemma h2I_uppercase_hex func(c byte) bool {

(c byte)

Source from the content-addressed store, hash-verified

63// return true
64// }
65func h2I(c byte) int {
66 if c >= 48 && c <= 57 { // '0'..'9'
67 return int(c - 48)
68 }
69 if c >= 65 && c <= 70 { // 'A'..'F'
70 return int(c-65) + 10
71 }
72 if c >= 97 && c <= 102 { // 'a'..'f'
73 return int(c-97) + 10
74 }
75 return badHex
76}
77
78// decodeSingleUnicodeEscape decodes a single \uXXXX escape sequence. The prefix \u is assumed to be present and
79// is not checked.

Callers 2

TestH2IFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestH2IFunction · 0.68