mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Merge pull request #5683 from thetarnav/soa-get-safe-contextless
Add "contextless" to small_array get_safe and get_ptr_safe
This commit is contained in:
@@ -169,7 +169,7 @@ Output:
|
|||||||
x
|
x
|
||||||
|
|
||||||
*/
|
*/
|
||||||
get_safe :: proc(a: $A/Small_Array($N, $T), index: int) -> (T, bool) #no_bounds_check {
|
get_safe :: proc "contextless" (a: $A/Small_Array($N, $T), index: int) -> (T, bool) #no_bounds_check {
|
||||||
if index < 0 || index >= a.len {
|
if index < 0 || index >= a.len {
|
||||||
return {}, false
|
return {}, false
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ Get a pointer to the item at the specified position.
|
|||||||
- the pointer to the element at the specified position
|
- the pointer to the element at the specified position
|
||||||
- true if element exists, false otherwise
|
- true if element exists, false otherwise
|
||||||
*/
|
*/
|
||||||
get_ptr_safe :: proc(a: ^$A/Small_Array($N, $T), index: int) -> (^T, bool) #no_bounds_check {
|
get_ptr_safe :: proc "contextless" (a: ^$A/Small_Array($N, $T), index: int) -> (^T, bool) #no_bounds_check {
|
||||||
if index < 0 || index >= a.len {
|
if index < 0 || index >= a.len {
|
||||||
return {}, false
|
return {}, false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user