Skip to content

Commit

Permalink
add a maybe better optimization, since current might not be as good (…
Browse files Browse the repository at this point in the history
…pointed out by @soraros)

Signed-off-by: martinvuyk <[email protected]>
  • Loading branch information
martinvuyk committed Dec 15, 2024
1 parent 70865d8 commit 7cfe7e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/src/collections/list.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ struct List[T: CollectionElement, hint_trivial_type: Bool = False](
Except for 0 capacity where it sets 1.
"""
if self.size >= self.capacity:
self._realloc(self.capacity * 2 + int(self.capacity == 0))
self._realloc(self.capacity * 2 | int(self.capacity == 0))
(self.data + self.size).init_pointee_move(value^)
self.size += 1

Expand Down

0 comments on commit 7cfe7e0

Please sign in to comment.