Skip to content

Commit

Permalink
Merge pull request #95 from he32/fix-aarch64eb
Browse files Browse the repository at this point in the history
src/lib.rs: make this build on big-endian aarch64.
  • Loading branch information
llogiq authored Oct 3, 2024
2 parents e6c7318 + 0430800 commit 240c02c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ mod integer_simd;
feature = "runtime-dispatch-simd",
any(target_arch = "x86", target_arch = "x86_64")
),
target_arch = "aarch64",
all(
target_arch = "aarch64",
target_endian = "little"
),
target_arch = "wasm32",
feature = "generic-simd"
))]
Expand Down Expand Up @@ -93,7 +96,11 @@ pub fn count(haystack: &[u8], needle: u8) -> usize {
}
}
}
#[cfg(all(target_arch = "aarch64", not(feature = "generic_simd")))]
#[cfg(all(
target_arch = "aarch64",
target_endian = "little",
not(feature = "generic_simd")
))]
{
unsafe {
return simd::aarch64::chunk_count(haystack, needle);
Expand Down Expand Up @@ -155,7 +162,11 @@ pub fn num_chars(utf8_chars: &[u8]) -> usize {
}
}
}
#[cfg(all(target_arch = "aarch64", not(feature = "generic_simd")))]
#[cfg(all(
target_arch = "aarch64",
target_endian = "little",
not(feature = "generic_simd")
))]
{
unsafe {
return simd::aarch64::chunk_num_chars(utf8_chars);
Expand Down

0 comments on commit 240c02c

Please sign in to comment.