Skip to content

Commit

Permalink
ASCII uppercase: add "subtract shifted bool" benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Mar 19, 2019
1 parent 0ad91f7 commit c1ec29a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libcore/benches/ascii.rs
Expand Up @@ -212,6 +212,18 @@ benches! {
}
}

fn case13_subtract_shifted_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 -= (is_ascii_lowercase(*byte) as u8) << 5
}
}

@iter

is_ascii,
Expand Down

0 comments on commit c1ec29a

Please sign in to comment.