Skip to content

Commit 334cc1b

Browse files
committed
Simplify arithmetic so it's easier to understand
1 parent d1df561 commit 334cc1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

queue.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func (q *Queue) resize() {
3535
if q.tail > q.head {
3636
copy(newBuf, q.buf[q.head:q.tail])
3737
} else {
38-
copy(newBuf, q.buf[q.head:len(q.buf)])
39-
copy(newBuf[len(q.buf)-q.head:], q.buf[:q.tail])
38+
n := copy(newBuf, q.buf[q.head:])
39+
copy(newBuf[n:], q.buf[:q.tail])
4040
}
4141

4242
q.head = 0

0 commit comments

Comments
 (0)