diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2023-08-26 19:09:04 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2023-08-26 19:09:04 +0200 |
| commit | 076b20a9a5c1e1604099a528e6bd9f5a679b3189 (patch) | |
| tree | 0026f83ac48e9780d103d8f07d69fbb8bd0ceae1 /core/container | |
| parent | 39c0a619ebaa9d950d87a58240320997da59db25 (diff) | |
fix queue reserve always doubling in size when there is enough space
Diffstat (limited to 'core/container')
| -rw-r--r-- | core/container/queue/queue.odin | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/container/queue/queue.odin b/core/container/queue/queue.odin index af44ef671..5783cbc6c 100644 --- a/core/container/queue/queue.odin +++ b/core/container/queue/queue.odin @@ -56,7 +56,7 @@ space :: proc(q: $Q/Queue($T)) -> int { // Reserve enough space for at least the specified capacity reserve :: proc(q: ^$Q/Queue($T), capacity: int) -> runtime.Allocator_Error { - if uint(capacity) > q.len { + if capacity > space(q^) { return _grow(q, uint(capacity)) } return nil |