Skip to content

Commit

Permalink
fix detail
Browse files Browse the repository at this point in the history
Signed-off-by: martinvuyk <[email protected]>
  • Loading branch information
martinvuyk committed Nov 21, 2024
1 parent 3674b4d commit b19cd7a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions stdlib/src/utils/string_slice.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ fn _utf8_first_byte_sequence_length(b: Byte) -> Int:
not _is_continuation_byte(b),
"Function does not work correctly if given a continuation byte.",
)
var flipped = ~b
return int(count_leading_zeros(flipped) + (flipped >> 7))
return int(count_leading_zeros(~b)) + int(b < 0b1000_0000)


fn _shift_unicode_to_utf8(ptr: UnsafePointer[UInt8], c: Int, num_bytes: Int):
Expand Down

0 comments on commit b19cd7a

Please sign in to comment.