ASCII uppercase: add "subtract multiplied bool" benchmark

This commit is contained in:
Simon Sapin 2019-03-19 13:41:59 +01:00
parent c1ec29ace0
commit 7fad370fe9

View File

@ -224,6 +224,18 @@ fn is_ascii_lowercase(b: u8) -> bool {
}
}
fn case14_subtract_multiplied_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
b'a'...b'z' => true,
_ => false
}
}
for byte in bytes {
*byte -= (b'a' - b'A') * is_ascii_lowercase(*byte) as u8
}
}
@iter
is_ascii,