aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2024-06-26 21:14:08 +0100
committerGitHub <noreply@github.com>2024-06-26 21:14:08 +0100
commitb1d06ea03fc394170bf509e4b8c91c18889b8b29 (patch)
tree6c45c48d4fbc61485e1bcb364fb2c666e570da2a
parente37afa3ada710a0f4e38efc8889f15cce51b2d05 (diff)
parentf227a406520064b81250960293f4db43844f83a0 (diff)
Merge pull request #3808 from karl-zylinski/fix-append-elem-max-confusion
Replace `max(8, 1)` in _append_elem with just `8` and a comment.
-rw-r--r--base/runtime/core_builtin.odin3
1 files changed, 2 insertions, 1 deletions
diff --git a/base/runtime/core_builtin.odin b/base/runtime/core_builtin.odin
index a9566c831..ff973054d 100644
--- a/base/runtime/core_builtin.odin
+++ b/base/runtime/core_builtin.odin
@@ -423,7 +423,8 @@ _append_elem :: #force_inline proc(array: ^$T/[dynamic]$E, arg: E, should_zero:
return 1, nil
} else {
if cap(array) < len(array)+1 {
- cap := 2 * cap(array) + max(8, 1)
+ // Same behavior as _append_elems but there's only one arg, so we always just add 8.
+ cap := 2 * cap(array) + 8
// do not 'or_return' here as it could be a partial success
if should_zero {