From 4b45669c557d43ccbf620e28e27c2b4bbd71c385 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sun, 29 Sep 2024 18:37:48 +0200 Subject: [PATCH] chore: remove some length checks --- src/arch/aarch64.rs | 2 +- src/arch/x86.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/arch/aarch64.rs b/src/arch/aarch64.rs index c2316ea..c51c536 100644 --- a/src/arch/aarch64.rs +++ b/src/arch/aarch64.rs @@ -23,7 +23,7 @@ cfg_if::cfg_if! { #[inline] pub(crate) unsafe fn encode(input: &[u8], output: *mut u8) { - if cfg!(miri) || !has_neon() || input.len() < CHUNK_SIZE { + if cfg!(miri) || !has_neon() { return generic::encode::(input, output); } encode_neon::(input, output); diff --git a/src/arch/x86.rs b/src/arch/x86.rs index 7191375..22779c4 100644 --- a/src/arch/x86.rs +++ b/src/arch/x86.rs @@ -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! { @@ -38,7 +37,7 @@ cfg_if::cfg_if! { #[inline] pub(crate) unsafe fn encode(input: &[u8], output: *mut u8) { - if !has_ssse3() || input.len() < CHUNK_SIZE_SSE { + if !has_ssse3() { return generic::encode::(input, output); } encode_ssse3::(input, output); @@ -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);