Skip to content

Commit

Permalink
Replace max(8, 1) in _append_elem with just 8 and a comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-zylinski committed Jun 25, 2024
1 parent 5d1d98c commit f227a40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/runtime/core_builtin.odin
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f227a40

Please sign in to comment.