Skip to content

Commit b17a98c

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

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

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)