aboutsummaryrefslogtreecommitdiff
path: root/core/container/queue
diff options
context:
space:
mode:
authorFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-11 07:07:19 -0400
committerFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-11 11:54:52 -0400
commit58bda1209a7aa261523b64935b62d80dc0877727 (patch)
tree7d9722c92bd2d8b8805658ebe33b280ad9be0304 /core/container/queue
parent27cd508571a8d7c9668147a602225231d5690e63 (diff)
container/queue: Deprecate `peek_*`
The `*_ptr` and `peek_*` procedures did the same thing, except `peek_*` was over-cautiously putting the index through a modulo when all assignments to `q.offset` are already wrapped.
Diffstat (limited to 'core/container/queue')
-rw-r--r--core/container/queue/queue.odin10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/container/queue/queue.odin b/core/container/queue/queue.odin
index 43eb14410..9e9dec2ec 100644
--- a/core/container/queue/queue.odin
+++ b/core/container/queue/queue.odin
@@ -127,16 +127,14 @@ get_ptr :: proc(q: ^$Q/Queue($T), #any_int i: int, loc := #caller_location) -> ^
return &q.data[idx]
}
+@(deprecated="Use `front_ptr` instead")
peek_front :: proc(q: ^$Q/Queue($T), loc := #caller_location) -> ^T {
- runtime.bounds_check_error_loc(loc, 0, builtin.len(q.data))
- idx := q.offset%builtin.len(q.data)
- return &q.data[idx]
+ return front_ptr(q, loc)
}
+@(deprecated="Use `back_ptr` instead")
peek_back :: proc(q: ^$Q/Queue($T), loc := #caller_location) -> ^T {
- runtime.bounds_check_error_loc(loc, int(q.len - 1), builtin.len(q.data))
- idx := (uint(q.len - 1)+q.offset)%builtin.len(q.data)
- return &q.data[idx]
+ return back_ptr(q, loc)
}
// Push an element to the back of the queue