2
0
Эх сурвалжийг харах

Merge pull request #761 from Tetralux/patch-7

Reuse container.Queue capacity when calling pop_front()
gingerBill 4 жил өмнө
parent
commit
ce35de47e4

+ 3 - 0
core/container/queue.odin

@@ -115,6 +115,9 @@ queue_pop_front :: proc(q: ^$Q/Queue($T)) -> T {
 	item := queue_get(q^, 0);
 	q.offset = (q.offset + 1) % array_len(q.data);
 	q.len -= 1;
+	if q.len == 0 {
+		q.offset = 0;
+	}
 	return item;
 }