diff options
| author | gingerBill <bill@gingerbill.org> | 2021-12-29 11:58:27 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-12-29 11:58:27 +0000 |
| commit | a66f859fb49b2d31809767aaa8b4d8872b73c062 (patch) | |
| tree | c73481b2b093dbdfc00259e168158c6928116e02 /core/container/small_array | |
| parent | c46e7eda1db0d509589dfca140802fdd3f2580eb (diff) | |
Minor improvements to `core:container/small_array`
Diffstat (limited to 'core/container/small_array')
| -rw-r--r-- | core/container/small_array/small_array.odin | 6 |
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[:]) |