# HG changeset patch # User ijl <ijl@mailbox.org> # Date 1597587745 0 # Sun Aug 16 14:22:25 2020 +0000 # Node ID 6d3eda83f2375e379913934aba01057a464b6831 # Parent 0ad6ce3d9dfc033e80145b424ec7d18ccb01655b Autovectorize is_four_byte() diff --git a/src/unicode.rs b/src/unicode.rs --- a/src/unicode.rs +++ b/src/unicode.rs @@ -34,12 +34,11 @@ const STATE_COMPACT: u32 = 0b00000000000000000000000000100000; fn is_four_byte(buf: &str) -> bool { + let mut ret = false; for &each in buf.as_bytes() { - if unlikely!(each >= 240) { - return true; - } + ret |= each >= 240; } - false + ret } enum PyUnicodeKind {