]> git.lizzy.rs Git - rust.git/commitdiff
Do not use pointer alignment on unsupported platforms
authorJustin Ridgewell <justin@ridgewell.name>
Fri, 5 Jul 2019 20:39:56 +0000 (16:39 -0400)
committerJustin Ridgewell <justin@ridgewell.name>
Fri, 5 Jul 2019 20:39:56 +0000 (16:39 -0400)
src/libcore/str/mod.rs

index 277dc6ff4a8ac7971ed097057f6e805bcc23f019..95756c27117c6ba6e425814ff07bc793c2668172 100644 (file)
@@ -1497,7 +1497,7 @@ macro_rules! next { () => {{
             // Ascii case, try to skip forward quickly.
             // When the pointer is aligned, read 2 words of data per iteration
             // until we find a word containing a non-ascii byte.
-            if align.wrapping_sub(index) % usize_bytes == 0 {
+            if align != usize::max_value() && align.wrapping_sub(index) % usize_bytes == 0 {
                 let ptr = v.as_ptr();
                 while index < blocks_end {
                     unsafe {