rust/library/core
Dylan DPC 7726265ae0
Rollup merge of #95831 - redzic:xor-uppercase, r=workingjubilee
Use bitwise XOR in to_ascii_uppercase

This saves an instruction compared to the previous approach, which
was to unset the fifth bit with bitwise OR.

Comparison of generated assembly on x86: https://godbolt.org/z/GdfvdGs39

This can also affect autovectorization, saving SIMD instructions as well: https://godbolt.org/z/cnPcz75T9

Not sure if `u8::to_ascii_lowercase` should also be changed, since using bitwise OR for that function does not require an extra bitwise negate since the code is setting a bit rather than unsetting a bit. `char::to_ascii_uppercase` already uses XOR, so no change seems to be required there.
2022-04-09 18:26:30 +02:00
..
benches Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
primitive_docs
src Rollup merge of #95831 - redzic:xor-uppercase, r=workingjubilee 2022-04-09 18:26:30 +02:00
tests Rollup merge of #95361 - scottmcm:valid-align, r=Mark-Simulacrum 2022-04-09 18:26:25 +02:00
Cargo.toml Build libcore as 2021 in a few more places 2022-02-06 15:41:01 -08:00