Quellcode durchsuchen

Simplify arithmetic so it's easier to understand

Dariusz Górecki vor 10 Jahren
Ursprung
Commit
334cc1b023
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      queue.go

+ 2 - 2
queue.go

@@ -35,8 +35,8 @@ func (q *Queue) resize() {
 	if q.tail > q.head {
 		copy(newBuf, q.buf[q.head:q.tail])
 	} else {
-		copy(newBuf, q.buf[q.head:len(q.buf)])
-		copy(newBuf[len(q.buf)-q.head:], q.buf[:q.tail])
+		n := copy(newBuf, q.buf[q.head:])
+		copy(newBuf[n:], q.buf[:q.tail])
 	}
 
 	q.head = 0