Commit 5e15497b authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

encoding/hex: change lookup table back to string

CL 27254 changed hextable to a byte array for performance.
CL 28219 fixed the compiler so that that is no longer necessary.
As Kirill notes in #15808, a string is preferable
as the linker can easily de-dup it.
So go back. No performance changes.

Change-Id: Ibef7d21d0f2507968a0606602c5dd57ed4a85b1b
Reviewed-on: https://go-review.googlesource.com/40970
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 17470786
...@@ -12,10 +12,7 @@ import ( ...@@ -12,10 +12,7 @@ import (
"io" "io"
) )
var hextable = [16]byte{ const hextable = "0123456789abcdef"
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f',
}
// EncodedLen returns the length of an encoding of n source bytes. // EncodedLen returns the length of an encoding of n source bytes.
// Specifically, it returns n * 2. // Specifically, it returns n * 2.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment