Fix list length calculation

This commit is contained in:
Richard Feldman 2020-07-18 23:02:41 -04:00
parent 6160a2b2f1
commit 3e61b6d165

View File

@ -2221,11 +2221,20 @@ fn list_append<'a, 'ctx, 'env>(
"add_list_lengths",
);
let elem_bytes = env
.ptr_int()
.const_int(elem_layout.stack_size(env.ptr_bytes) as u64, false);
let combined_bytes = builder.build_int_mul(
combined_list_len,
elem_bytes,
"add_list_lengths",
);
let combined_list_ptr = env
.builder
.build_array_malloc(
elem_type,
combined_list_len,
combined_bytes,
"create_combined_list_ptr",
)
.unwrap();