1
Fork 0

Unify way to flip 6th bit. (Same assembly generated)

This commit is contained in:
Giles Cope 2021-02-08 12:21:36 +00:00
parent f30c51abe8
commit cadcf5ed99
No known key found for this signature in database
GPG key ID: DF85161DAE0FF36B
4 changed files with 11 additions and 8 deletions

View file

@ -66,6 +66,8 @@ macro_rules! benches {
use test::black_box;
use test::Bencher;
const ASCII_CASE_MASK: u8 = 0b0010_0000;
benches! {
fn case00_alloc_only(_bytes: &mut [u8]) {}
@ -204,7 +206,7 @@ benches! {
}
}
for byte in bytes {
*byte &= !((is_ascii_lowercase(*byte) as u8) << 5)
*byte &= !((is_ascii_lowercase(*byte) as u8) * ASCII_CASE_MASK)
}
}
@ -216,7 +218,7 @@ benches! {
}
}
for byte in bytes {
*byte -= (is_ascii_lowercase(*byte) as u8) << 5
*byte -= (is_ascii_lowercase(*byte) as u8) * ASCII_CASE_MASK
}
}