Skip to content

Commit

Permalink
chore: remove some length checks
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Sep 29, 2024
1 parent 2f2c809 commit 4b45669
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/arch/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cfg_if::cfg_if! {

#[inline]
pub(crate) unsafe fn encode<const UPPER: bool>(input: &[u8], output: *mut u8) {
if cfg!(miri) || !has_neon() || input.len() < CHUNK_SIZE {
if cfg!(miri) || !has_neon() {
return generic::encode::<UPPER>(input, output);
}
encode_neon::<UPPER>(input, output);
Expand Down
5 changes: 2 additions & 3 deletions src/arch/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use core::arch::x86::*;
use core::arch::x86_64::*;

pub(crate) const USE_CHECK_FN: bool = true;
const CHUNK_SIZE_SSE: usize = core::mem::size_of::<__m128i>();
const CHUNK_SIZE_AVX: usize = core::mem::size_of::<__m256i>();

cfg_if::cfg_if! {
Expand Down Expand Up @@ -38,7 +37,7 @@ cfg_if::cfg_if! {

#[inline]
pub(crate) unsafe fn encode<const UPPER: bool>(input: &[u8], output: *mut u8) {
if !has_ssse3() || input.len() < CHUNK_SIZE_SSE {
if !has_ssse3() {
return generic::encode::<UPPER>(input, output);
}
encode_ssse3::<UPPER>(input, output);
Expand Down Expand Up @@ -105,7 +104,7 @@ unsafe fn check_sse2(input: &[u8]) -> bool {

#[inline]
pub(crate) unsafe fn decode_unchecked(input: &[u8], output: &mut [u8]) {
if !has_avx2() || input.len() < CHUNK_SIZE_AVX {
if !has_avx2() {
return generic::decode_unchecked(input, output);
}
decode_avx2(input, output);
Expand Down

0 comments on commit 4b45669

Please sign in to comment.