Skip to content

Commit

Permalink
Do not use pointer alignment on unsupported platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Jul 5, 2019
1 parent 3d2c4ff commit 3b6e8ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> {
// 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 {
Expand Down

0 comments on commit 3b6e8ed

Please sign in to comment.