Skip to content

Commit

Permalink
Some more iexing
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <[email protected]>
  • Loading branch information
Licenser committed Aug 24, 2024
1 parent 45e0f29 commit 478bbbd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/impls/neon/deser.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use iex::Outcome;

use crate::error::ErrorType;
use crate::impls::neon::stage1::bit_mask;
use crate::safer_unchecked::GetSaferUnchecked;
Expand Down Expand Up @@ -169,14 +171,11 @@ pub(crate) fn parse_str<'invoke, 'de>(
// within the unicode codepoint handling code.
src_i += bs_dist as usize;
dst_i += bs_dist as usize;
let (o, s) = if let Ok(r) =
let (o, s) =
handle_unicode_codepoint(unsafe { src.get_kinda_unchecked(src_i..) }, unsafe {
buffer.get_kinda_unchecked_mut(dst_i..)
}) {
r
} else {
return Err(Deserializer::error_c(src_i, 'u', InvalidUnicodeCodepoint));
};
})
.map_err(|_| Deserializer::error_c(src_i, 'u', InvalidUnicodeCodepoint))?;
if o == 0 {
return Err(Deserializer::error_c(src_i, 'u', InvalidUnicodeCodepoint));
};
Expand Down
4 changes: 4 additions & 0 deletions src/numberparse/approx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ impl<'de> Deserializer<'de> {
clippy::cast_precision_loss,
clippy::too_many_lines
)]
#[iex::iex]
fn parse_float(idx: usize, p: &[u8], negative: bool) -> Result<StaticNode> {
let mut digitcount = usize::from(negative);
let mut i: f64;
Expand Down Expand Up @@ -222,6 +223,7 @@ impl<'de> Deserializer<'de> {
#[cfg(not(feature = "128bit"))]
#[inline(never)]
#[allow(clippy::cast_possible_wrap)]
#[iex::iex]
fn parse_large_integer(idx: usize, buf: &[u8], negative: bool) -> Result<StaticNode> {
let mut digitcount = usize::from(negative);
let mut i: u64;
Expand Down Expand Up @@ -283,6 +285,7 @@ impl<'de> Deserializer<'de> {
#[cfg(feature = "128bit")]
#[inline(never)]
#[allow(clippy::cast_possible_wrap)]
#[iex::iex]
fn parse_large_integer(idx: usize, buf: &[u8], negative: bool) -> Result<StaticNode> {
let mut digitcount = usize::from(negative);
let mut i: u128;
Expand Down Expand Up @@ -358,6 +361,7 @@ impl<'de> Deserializer<'de> {
clippy::cast_possible_wrap,
clippy::too_many_lines
)]
#[iex::iex]
pub(crate) fn parse_number(idx: usize, buf: &[u8], negative: bool) -> Result<StaticNode> {
let buf = unsafe { buf.get_kinda_unchecked(idx..) };
let mut byte_count = usize::from(negative);
Expand Down
2 changes: 2 additions & 0 deletions src/stringparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const LOW_SURROGATES: Range<u32> = 0xdc00..0xe000;
/// write appropriate values into dest
#[cfg_attr(not(feature = "no-inline"), inline)]
#[allow(dead_code)]
#[iex::iex]
pub(crate) fn handle_unicode_codepoint(
src_ptr: &[u8],
dst_ptr: &mut [u8],
Expand All @@ -45,6 +46,7 @@ pub(crate) fn handle_unicode_codepoint(
/// return true if the unicode codepoint was valid
/// We work in little-endian then swap at write time
#[cfg_attr(not(feature = "no-inline"), inline)]
#[iex::iex]
pub(crate) fn get_unicode_codepoint(mut src_ptr: &[u8]) -> Result<(u32, usize), ErrorType> {
// hex_to_u32_nocheck fills high 16 bits of the return value with 1s if the
// conversion isn't valid; we defer the check for this to inside the
Expand Down

0 comments on commit 478bbbd

Please sign in to comment.