Commit 30c0a0d3 authored by Stepan Shabalin's avatar Stepan Shabalin Committed by Keith Randall

runtime: remove redundant slicing

In the twoNonZero function in hash_test, the buffer is sliced as [:] three times. This change deletes them.

Change-Id: I0701d0c810b4f3e267f80133a0dcdb4ed81fe356
Reviewed-on: https://go-review.googlesource.com/c/156138Reviewed-by: 's avatarKeith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 374546d8
...@@ -177,13 +177,13 @@ func twoNonZero(h *HashSet, n int) { ...@@ -177,13 +177,13 @@ func twoNonZero(h *HashSet, n int) {
b := make([]byte, n) b := make([]byte, n)
// all zero // all zero
h.addB(b[:]) h.addB(b)
// one non-zero byte // one non-zero byte
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
for x := 1; x < 256; x++ { for x := 1; x < 256; x++ {
b[i] = byte(x) b[i] = byte(x)
h.addB(b[:]) h.addB(b)
b[i] = 0 b[i] = 0
} }
} }
...@@ -195,7 +195,7 @@ func twoNonZero(h *HashSet, n int) { ...@@ -195,7 +195,7 @@ func twoNonZero(h *HashSet, n int) {
for j := i + 1; j < n; j++ { for j := i + 1; j < n; j++ {
for y := 1; y < 256; y++ { for y := 1; y < 256; y++ {
b[j] = byte(y) b[j] = byte(y)
h.addB(b[:]) h.addB(b)
b[j] = 0 b[j] = 0
} }
} }
......
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