mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
make specific twice_ptr_width
helper
This commit is contained in:
parent
9d9e7d10d4
commit
4e22ae57cd
2 changed files with 9 additions and 4 deletions
|
@ -204,12 +204,17 @@ impl<'a, 'ctx, 'env> Env<'a, 'ctx, 'env> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The integer type representing a RocList or RocStr when following the C ABI
|
/// The integer type representing twice the width of a pointer
|
||||||
///
|
///
|
||||||
/// on 64-bit systems, this is i128
|
/// on 64-bit systems, this is i128
|
||||||
/// on 32-bit systems, this is i64
|
/// on 32-bit systems, this is i64
|
||||||
pub fn str_list_c_abi(&self) -> IntType<'ctx> {
|
pub fn twice_ptr_int(&self) -> IntType<'ctx> {
|
||||||
crate::llvm::convert::str_list_int(self.context, self.target_info)
|
let ctx = self.context;
|
||||||
|
|
||||||
|
match self.target_info.ptr_width() {
|
||||||
|
roc_target::PtrWidth::Bytes4 => ctx.i64_type(),
|
||||||
|
roc_target::PtrWidth::Bytes8 => ctx.i128_type(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn small_str_bytes(&self) -> u32 {
|
pub fn small_str_bytes(&self) -> u32 {
|
||||||
|
|
|
@ -359,7 +359,7 @@ pub fn str_from_utf8_range<'a, 'ctx, 'env>(
|
||||||
complex_bitcast(
|
complex_bitcast(
|
||||||
env.builder,
|
env.builder,
|
||||||
count_and_start.into(),
|
count_and_start.into(),
|
||||||
env.str_list_c_abi().into(),
|
env.twice_ptr_int().into(),
|
||||||
"to_i128",
|
"to_i128",
|
||||||
),
|
),
|
||||||
result_ptr.into(),
|
result_ptr.into(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue