mirror of
https://github.com/serde-rs/json.git
synced 2025-09-29 22:11:13 +00:00
Big endian support
This commit is contained in:
parent
5496579070
commit
a95d6df9d0
@ -453,9 +453,14 @@ 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
|
||||
+ masked.trailing_zeros() as usize / 8;
|
||||
+ addresswise_first_bit as usize / 8;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user