diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-18 10:54:10 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-18 18:16:08 +0000 |
commit | 5e15497b5682acfe5c761bc116c6f157efcc8042 (patch) | |
tree | 60b61f986f77393736edf5e07b0edd53d09f4e50 /src/encoding/hex | |
parent | 174707869544b246c055b9a5f53ca7d4ea860b67 (diff) | |
download | go-5e15497b5682acfe5c761bc116c6f157efcc8042.tar.gz go-5e15497b5682acfe5c761bc116c6f157efcc8042.zip |
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: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/encoding/hex')
-rw-r--r-- | src/encoding/hex/hex.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/encoding/hex/hex.go b/src/encoding/hex/hex.go index b43c1c4b45..2768f1bac6 100644 --- a/src/encoding/hex/hex.go +++ b/src/encoding/hex/hex.go @@ -12,10 +12,7 @@ import ( "io" ) -var hextable = [16]byte{ - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f', -} +const hextable = "0123456789abcdef" // EncodedLen returns the length of an encoding of n source bytes. // Specifically, it returns n * 2. |