Skip to content

Commit 5e15497

Browse files
committed
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 <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 1747078 commit 5e15497

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/encoding/hex/hex.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ import (
1212
"io"
1313
)
1414

15-
var hextable = [16]byte{
16-
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
17-
'a', 'b', 'c', 'd', 'e', 'f',
18-
}
15+
const hextable = "0123456789abcdef"
1916

2017
// EncodedLen returns the length of an encoding of n source bytes.
2118
// Specifically, it returns n * 2.

0 commit comments

Comments
 (0)