diff --git a/Cargo.toml b/Cargo.toml index 0596c306c..90fd2b5ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.123" +version = "1.0.124" authors = ["Erick Tryzelaar ", "David Tolnay "] categories = ["encoding", "parser-implementations", "no-std"] description = "A JSON serialization file format" diff --git a/src/lib.rs b/src/lib.rs index beefec18d..c1d645654 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -299,7 +299,7 @@ //! [macro]: crate::json //! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.123")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.124")] // Ignored clippy lints #![allow( clippy::collapsible_else_if, diff --git a/src/read.rs b/src/read.rs index 1494ec6d2..6c663768e 100644 --- a/src/read.rs +++ b/src/read.rs @@ -453,7 +453,7 @@ impl<'a> SliceRead<'a> { const ONE_BYTES: Chunk = Chunk::MAX / 255; // 0x0101...01 for chunk in rest.chunks_exact(STEP) { - let chars = Chunk::from_ne_bytes(chunk.try_into().unwrap()); + let chars = Chunk::from_le_bytes(chunk.try_into().unwrap()); let contains_ctrl = chars.wrapping_sub(ONE_BYTES * 0x20) & !chars; let chars_quote = chars ^ (ONE_BYTES * Chunk::from(b'"')); let contains_quote = chars_quote.wrapping_sub(ONE_BYTES) & !chars_quote; @@ -461,14 +461,9 @@ impl<'a> SliceRead<'a> { let contains_backslash = chars_backslash.wrapping_sub(ONE_BYTES) & !chars_backslash; let masked = (contains_ctrl | contains_quote | contains_backslash) & (ONE_BYTES << 7); if masked != 0 { - let addresswise_first_bit = if cfg!(target_endian = "little") { - masked.trailing_zeros() - } else { - masked.leading_zeros() - }; // SAFETY: chunk is in-bounds for slice self.index = unsafe { chunk.as_ptr().offset_from(self.slice.as_ptr()) } as usize - + addresswise_first_bit as usize / 8; + + masked.trailing_zeros() as usize / 8; return; } } diff --git a/tests/test.rs b/tests/test.rs index 6baf7e5d9..9f2159513 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -2504,7 +2504,7 @@ fn test_control_character_search() { for n in 0..16 { for m in 0..16 { test_parse_err::(&[( - &format!("\"{}\n{}\"", ".".repeat(n), ".".repeat(m)), + &format!("\"{}\n{}\"", " ".repeat(n), " ".repeat(m)), "control character (\\u0000-\\u001F) found while parsing a string at line 2 column 0", )]); }