aboutsummaryrefslogtreecommitdiff
path: root/core/container/small_array/small_array.odin
diff options
context:
space:
mode:
Diffstat (limited to 'core/container/small_array/small_array.odin')
-rw-r--r--core/container/small_array/small_array.odin6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/container/small_array/small_array.odin b/core/container/small_array/small_array.odin
index 60c22837c..d09e0c81c 100644
--- a/core/container/small_array/small_array.odin
+++ b/core/container/small_array/small_array.odin
@@ -42,16 +42,16 @@ resize :: proc(a: ^$A/Small_Array, length: int) {
push_back :: proc(a: ^$A/Small_Array($N, $T), item: T) -> bool {
- if a.len < builtin.len(a.data) {
+ if a.len < cap(a^) {
+ a.data[a.len] = item
a.len += 1
- a.data[a.len-1] = item
return true
}
return false
}
push_front :: proc(a: ^$A/Small_Array($N, $T), item: T) -> bool {
- if a.len < builtin.len(a.data) {
+ if a.len < cap(a^) {
a.len += 1
data := slice(a)
copy(data[1:], data[:])