Skip to content

Commit

Permalink
fix: Fix compilation of fallback backend and minor issues (#155)
Browse files Browse the repository at this point in the history
* Fix imports in v128 fallback

* Fix compilation on 32-bit architectures

* Update de.rs

---------

Co-authored-by: liu <[email protected]>
  • Loading branch information
aumetra and liuq19 authored Jan 27, 2025
1 parent 47b4f0f commit f166dc7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions sonic-simd/src/v128.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::ops::{BitAnd, BitOr, BitOrAssign};

use super::{Mask, Simd};

#[derive(Debug)]
pub struct Simd128i([i8; 16]);

Expand Down
2 changes: 1 addition & 1 deletion src/serde/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ where
// check JSON size, because the design of `sonic_rs::Value`, parsing JSON larger than 4 GB is
// not supported
let len = read.as_u8_slice().len();
if len >= (1 << 32) {
if len > u32::MAX as _ {
return Err(crate::error::make_error(format!(
"Only support JSON less than 4 GB, the input JSON is too large here, len is {len}"
)));
Expand Down
4 changes: 2 additions & 2 deletions src/value/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,15 +1492,15 @@ impl<'a> DocumentVisitor<'a> {
#[repr(C)]
struct MetaNode {
shared: *const Shared,
canary: usize,
canary: u64,
}

impl MetaNode {
fn new(shared: *const Shared) -> Self {
let canary = b"SONICRS\0";
MetaNode {
shared,
canary: unsafe { transmute::<&[u8; 8], usize>(canary) },
canary: unsafe { transmute::<[u8; 8], u64>(*canary) },
}
}
}
Expand Down

0 comments on commit f166dc7

Please sign in to comment.