mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
fix string repeat tests
This commit is contained in:
parent
dea6cfbc8f
commit
2c4d0e71a6
5 changed files with 50 additions and 34 deletions
|
@ -856,16 +856,17 @@ fn modify_refcount_str_help<'a, 'ctx, 'env>(
|
|||
let parent = fn_val;
|
||||
|
||||
let str_wrapper = arg_val.into_struct_value();
|
||||
let len = builder
|
||||
.build_extract_value(str_wrapper, Builtin::WRAPPER_LEN, "read_str_ptr")
|
||||
|
||||
let capacity = builder
|
||||
.build_extract_value(str_wrapper, Builtin::WRAPPER_CAPACITY, "read_str_capacity")
|
||||
.unwrap()
|
||||
.into_int_value();
|
||||
|
||||
// Small strings have 1 as the first bit of length, making them negative.
|
||||
// Small strings have 1 as the first bit of capacity, making them negative.
|
||||
// Thus, to check for big and non empty, just needs a signed len > 0.
|
||||
let is_big_and_non_empty = builder.build_int_compare(
|
||||
IntPredicate::SGT,
|
||||
len,
|
||||
capacity,
|
||||
env.ptr_int().const_zero(),
|
||||
"is_big_str",
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue