This commit is contained in:
Taras Tsugrii 2025-06-20 15:37:17 -04:00 committed by GitHub
commit 4fb583c61a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -31,10 +31,8 @@ func (q *queue) grow() {
newCap = 8
}
newElems := make([]any, newCap)
oldLen := q.len
for i := 0; i < oldLen; i++ {
newElems[i] = q.elems[(q.head+i)%oldCap]
}
wrote := copy(newElems, q.elems[q.head:])
copy(newElems[wrote:], q.elems[:q.head])
q.elems = newElems
q.head = 0
}