diff --git a/bytesconv.go b/bytesconv.go index e0262e7a32..d4fba6717c 100644 --- a/bytesconv.go +++ b/bytesconv.go @@ -296,7 +296,7 @@ func writeHexInt(w *bufio.Writer, n int) error { buf := v.([]byte) i := len(buf) - 1 for { - buf[i] = upperhex[n&0xf] + buf[i] = lowerhex[n&0xf] n >>= 4 if n == 0 { break @@ -327,6 +327,7 @@ var hex2intTable = func() []byte { const ( toLower = 'a' - 'A' upperhex = "0123456789ABCDEF" + lowerhex = "0123456789abcdef" ) var toLowerTable = func() [256]byte { diff --git a/bytesconv_timing_test.go b/bytesconv_timing_test.go index f817cf475b..b747181904 100644 --- a/bytesconv_timing_test.go +++ b/bytesconv_timing_test.go @@ -65,18 +65,6 @@ func BenchmarkAppendIPv4(b *testing.B) { }) } -func BenchmarkInt2HexByte(b *testing.B) { - buf := []int{1, 0xf, 2, 0xd, 3, 0xe, 4, 0xa, 5, 0xb, 6, 0xc, 7, 0xf, 0, 0xf, 6, 0xd, 9, 8, 4, 0x5} - b.RunParallel(func(pb *testing.PB) { - var n int - for pb.Next() { - for _, n = range buf { - int2hexbyte(n) - } - } - }) -} - func BenchmarkWriteHexInt(b *testing.B) { b.RunParallel(func(pb *testing.PB) { var w bytebufferpool.ByteBuffer