Skip to content

Commit f46dc2a

Browse files
liushuyuLicenser
authored andcommitted
Fix compatibility on unsupported CPU architectures
1 parent 4e31862 commit f46dc2a

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@ impl<'de> Deserializer<'de> {
482482
}
483483
}
484484
#[cfg(not(any(
485-
feature = "runtime-detection",
485+
all(
486+
feature = "runtime-detection",
487+
any(target_arch = "x86_64", target_arch = "x86")
488+
),
486489
feature = "portable",
487490
target_feature = "avx2",
488491
target_feature = "sse4.2",
@@ -594,7 +597,10 @@ impl<'de> Deserializer<'de> {
594597
}
595598
#[cfg_attr(not(feature = "no-inline"), inline)]
596599
#[cfg(not(any(
597-
feature = "runtime-detection",
600+
all(
601+
feature = "runtime-detection",
602+
any(target_arch = "x86_64", target_arch = "x86")
603+
),
598604
feature = "portable",
599605
target_feature = "avx2",
600606
target_feature = "sse4.2",
@@ -730,7 +736,10 @@ impl<'de> Deserializer<'de> {
730736
}
731737

732738
#[cfg(not(any(
733-
feature = "runtime-detection",
739+
all(
740+
feature = "runtime-detection",
741+
any(target_arch = "x86_64", target_arch = "x86")
742+
),
734743
feature = "portable",
735744
target_feature = "avx2",
736745
target_feature = "sse4.2",

src/numberparse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn parse_eight_digits_unrolled(chars: &[u8]) -> u32 {
110110

111111
#[cfg_attr(not(feature = "no-inline"), inline)]
112112
#[cfg(all(
113-
any(target_feature = "neon", target_feature = "simd128"),
113+
not(any(target_arch = "x86", target_arch = "x86_64")),
114114
feature = "swar-number-parsing"
115115
))]
116116
#[allow(clippy::cast_ptr_alignment)]

src/stringparse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const LOW_SURROGATES: Range<u32> = 0xdc00..0xe000;
2828
/// handle a unicode codepoint
2929
/// write appropriate values into dest
3030
#[cfg_attr(not(feature = "no-inline"), inline)]
31+
#[allow(dead_code)]
3132
pub(crate) fn handle_unicode_codepoint(
3233
src_ptr: &[u8],
3334
dst_ptr: &mut [u8],

0 commit comments

Comments
 (0)