diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-16 19:06:46 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-16 21:24:15 -0700 |
commit | 2b7fff828e29b63ae08a871b4b1e74784fab29e5 (patch) | |
tree | d95b3a00d4703c4c5eb41dce1529e4d675293ce5 /internal/jsonstring/encode_string.go | |
parent | 1e2d058c78969118b099940afdb100a3b93325cc (diff) |
Clean up the hex handling
Diffstat (limited to 'internal/jsonstring/encode_string.go')
-rw-r--r-- | internal/jsonstring/encode_string.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/jsonstring/encode_string.go b/internal/jsonstring/encode_string.go index f29dc3f..a7670c6 100644 --- a/internal/jsonstring/encode_string.go +++ b/internal/jsonstring/encode_string.go @@ -10,7 +10,6 @@ import ( "unicode/utf8" "git.lukeshu.com/go/lowmemjson/internal/fastio" - "git.lukeshu.com/go/lowmemjson/internal/jsonparse" ) // BackslashEscapeMode is describe in the main lowmemjson package @@ -27,13 +26,14 @@ const ( type BackslashEscaper = func(rune, BackslashEscapeMode) BackslashEscapeMode func writeStringUnicodeEscape(w io.Writer, c rune) (int, error) { + const alphabet = "0123456789abcdef" buf := [6]byte{ '\\', 'u', - jsonparse.Hex[(c>>12)&0xf], - jsonparse.Hex[(c>>8)&0xf], - jsonparse.Hex[(c>>4)&0xf], - jsonparse.Hex[(c>>0)&0xf], + alphabet[(c>>12)&0xf], + alphabet[(c>>8)&0xf], + alphabet[(c>>4)&0xf], + alphabet[(c>>0)&0xf], } return w.Write(buf[:]) } |