We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c01967b + 7293c57 commit 36e987bCopy full SHA for 36e987b
crates/string-offsets/src/lib.rs
@@ -385,8 +385,8 @@ fn new_converter(content: &[u8]) -> StringOffsets {
385
/// Returns 0 if the byte is not a valid first byte of a UTF-8 char.
386
fn utf8_width(c: u8) -> usize {
387
// Every nibble represents the utf8 length given the first 4 bits of a utf8 encoded byte.
388
- const UTF8_WIDTH: usize = 0x4322_0000_1111_1111;
389
- (UTF8_WIDTH >> ((c >> 4) * 4)) & 0xf
+ const UTF8_WIDTH: u64 = 0x4322_0000_1111_1111;
+ ((UTF8_WIDTH >> ((c >> 4) * 4)) & 0xf) as usize
390
}
391
392
fn utf8_to_utf16_width(content: &[u8]) -> usize {
0 commit comments