mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 03:12:20 +00:00
deal with zero element_width
That being said, this only affects wasm. So wasm probably should be handling zero element lists in a smarter way.
This commit is contained in:
parent
f9c87d9190
commit
eca4682787
1 changed files with 6 additions and 1 deletions
|
@ -150,7 +150,12 @@ pub const RocList = extern struct {
|
|||
element_width: usize,
|
||||
) usize {
|
||||
var new_capacity: usize = 0;
|
||||
if (old_capacity == 0) {
|
||||
// TODO: I think this shouldn't be done here.
|
||||
// We should have a smarter way to deal with this that doesn't lead
|
||||
// to allocating a refcount for zero width elements.
|
||||
if (element_width == 0) {
|
||||
return requested_length;
|
||||
} else if (old_capacity == 0) {
|
||||
new_capacity = 64 / element_width;
|
||||
} else if (old_capacity < 4096 / element_width) {
|
||||
new_capacity = old_capacity * 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue