mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
add seamless slices for str
This commit is contained in:
parent
24c403eba0
commit
3978059aa2
5 changed files with 122 additions and 35 deletions
|
@ -63,3 +63,19 @@ pub(crate) fn str_equal<'a, 'ctx, 'env>(
|
|||
bitcode::STR_EQUAL,
|
||||
)
|
||||
}
|
||||
|
||||
// Gets a pointer to just after the refcount for a list or seamless slice.
|
||||
// The value is just after the refcount so that normal lists and seamless slices can share code paths easily.
|
||||
pub(crate) fn str_refcount_ptr<'a, 'ctx, 'env>(
|
||||
env: &Env<'a, 'ctx, 'env>,
|
||||
value: BasicValueEnum<'ctx>,
|
||||
) -> PointerValue<'ctx> {
|
||||
call_str_bitcode_fn(
|
||||
env,
|
||||
&[value],
|
||||
&[],
|
||||
BitcodeReturns::Basic,
|
||||
bitcode::STR_REFCOUNT_PTR,
|
||||
)
|
||||
.into_pointer_value()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue