1
0
mirror of https://github.com/fumiama/go-base16384.git synced 2026-06-11 05:30:41 +08:00

优化代码结构

This commit is contained in:
源文雨
2023-04-19 15:33:33 +08:00
parent e8419f8b75
commit d548cdd86f
4 changed files with 16 additions and 31 deletions

View File

@@ -121,7 +121,7 @@ func benchEncode(b *testing.B, data []byte) {
b.SetBytes(int64(len(data)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = EncodeTo(data, buf)
_, _ = EncodeTo(data, buf)
}
}
@@ -131,14 +131,14 @@ func benchDecode(b *testing.B, data []byte) {
panic(err)
}
buf := make([]byte, EncodeLen(len(data)))
err = EncodeTo(data, buf)
_, err = EncodeTo(data, buf)
if err != nil {
panic(err)
}
b.SetBytes(int64(len(buf)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = DecodeTo(buf, data)
_, _ = DecodeTo(buf, data)
}
}