mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
use ptr_int
This commit is contained in:
parent
d0be0df83c
commit
f5e5ec42ad
1 changed files with 6 additions and 4 deletions
|
@ -138,9 +138,11 @@ pub fn list_prepend<'a, 'ctx, 'env>(
|
||||||
let list_ptr = load_list_ptr(builder, original_wrapper, ptr_type);
|
let list_ptr = load_list_ptr(builder, original_wrapper, ptr_type);
|
||||||
|
|
||||||
// The output list length, which is the old list length + 1
|
// The output list length, which is the old list length + 1
|
||||||
let new_list_len =
|
let new_list_len = env.builder.build_int_add(
|
||||||
env.builder
|
env.ptr_int().const_int(1_u64, false),
|
||||||
.build_int_add(env.ptr_int.const_int(1_u64, false), len, "new_list_length");
|
len,
|
||||||
|
"new_list_length",
|
||||||
|
);
|
||||||
|
|
||||||
// Allocate space for the new array that we'll copy into.
|
// Allocate space for the new array that we'll copy into.
|
||||||
let clone_ptr = allocate_list(env, elem_layout, new_list_len);
|
let clone_ptr = allocate_list(env, elem_layout, new_list_len);
|
||||||
|
@ -150,7 +152,7 @@ pub fn list_prepend<'a, 'ctx, 'env>(
|
||||||
let index_1_ptr = unsafe {
|
let index_1_ptr = unsafe {
|
||||||
builder.build_in_bounds_gep(
|
builder.build_in_bounds_gep(
|
||||||
clone_ptr,
|
clone_ptr,
|
||||||
&[env.ptr_int.const_int(1_u64, false)],
|
&[env.ptr_int().const_int(1_u64, false)],
|
||||||
"load_index",
|
"load_index",
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue