Skip to content

Commit e650d48

Browse files
committed
simd-alignment
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
1 parent 2783551 commit e650d48

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/impls/simd128/stage1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{Stage1Parse, SIMDINPUT_LENGTH};
1+
use crate::{SIMDINPUT_LENGTH, Stage1Parse};
22
use std::arch::wasm32::{
33
i8x16_splat, u8x16, u8x16_bitmask, u8x16_eq, u8x16_le, u8x16_shr, u8x16_splat, u8x16_swizzle,
44
u32x4, u32x4_add, u32x4_splat, v128, v128_and, v128_load, v128_store,

src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,14 +1036,12 @@ impl AlignedBuf {
10361036
if mem::size_of::<usize>() < 8 && capacity > isize::MAX as usize {
10371037
Self::capacity_overflow()
10381038
}
1039-
let layout = match Layout::from_size_align(capacity, SIMDINPUT_LENGTH) {
1040-
Ok(layout) => layout,
1041-
Err(_) => Self::capacity_overflow(),
1039+
let Ok(layout) = Layout::from_size_align(capacity, SIMDJSON_PADDING) else {
1040+
Self::capacity_overflow()
10421041
};
10431042

1044-
let inner = match unsafe { NonNull::new(alloc(layout)) } {
1045-
Some(ptr) => ptr,
1046-
None => handle_alloc_error(layout),
1043+
let Some(inner) = (unsafe { NonNull::new(alloc(layout)) }) else {
1044+
handle_alloc_error(layout)
10471045
};
10481046
Self {
10491047
layout,

0 commit comments

Comments
 (0)