about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/core/src/num/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
index a30d2ff0ea6..98c9bf556bb 100644
--- a/library/core/src/num/mod.rs
+++ b/library/core/src/num/mod.rs
@@ -299,8 +299,8 @@ impl u8 {
     #[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.52.0")]
     #[inline]
     pub const fn to_ascii_uppercase(&self) -> u8 {
-        // Unset the fifth bit if this is a lowercase letter
-        *self & !((self.is_ascii_lowercase() as u8) * ASCII_CASE_MASK)
+        // Toggle the fifth bit if this is a lowercase letter
+        *self ^ ((self.is_ascii_lowercase() as u8) * ASCII_CASE_MASK)
     }
 
     /// Makes a copy of the value in its ASCII lower case equivalent.