mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-15 21:23:57 +00:00
Account for seamless slices in C roc_str_len
This commit is contained in:
parent
75ca8816c3
commit
f862540c65
1 changed files with 1 additions and 1 deletions
|
|
@ -186,7 +186,7 @@ size_t roc_str_len(struct RocStr str)
|
|||
uint8_t last_byte = bytes[sizeof(str) - 1];
|
||||
uint8_t last_byte_xored = last_byte ^ 0b10000000;
|
||||
size_t small_len = (size_t)(last_byte_xored);
|
||||
size_t big_len = str.len;
|
||||
size_t big_len = str.len & PTRDIFF_MAX; // Account for seamless slices
|
||||
|
||||
// Avoid branch misprediction costs by always
|
||||
// determining both small_len and big_len,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue