From 90ac43dfa954e1d261f757dc4e2507b8819c5095 Mon Sep 17 00:00:00 2001 From: Tpt Date: Thu, 2 Feb 2023 08:34:02 +0100 Subject: [PATCH] Uses static target detection --- src/index.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/index.rs b/src/index.rs index c4b3af37..d9685f45 100644 --- a/src/index.rs +++ b/src/index.rs @@ -235,22 +235,14 @@ impl IndexTable { Ok(try_io!(Ok(&map[offset..offset + CHUNK_LEN]))) } + #[cfg(target_feature = "sse2")] fn find_entry(&self, key_prefix: u64, sub_index: usize, chunk: &[u8]) -> (Entry, usize) { - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - if is_x86_feature_detected!("sse2") { - return self.find_entry_sse2(key_prefix, sub_index, chunk) - } - self.find_entry_regular(key_prefix, sub_index, chunk) - } - - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - fn find_entry_sse2(&self, key_prefix: u64, sub_index: usize, chunk: &[u8]) -> (Entry, usize) { assert!(chunk.len() >= CHUNK_ENTRIES * 8); // Bound checking (not done by SIMD instructions) debug_assert!( Entry::address_bits(self.id.index_bits()) <= 32, "To be sure we can use all high 32 bits as key prefix" ); - debug_assert_eq!( + const _: () = assert_eq!( CHUNK_ENTRIES % 4, 0, "We assume here we got buffer with a number of elements that is a multiple of 4" @@ -283,7 +275,8 @@ impl IndexTable { (Entry::empty(), 0) } - fn find_entry_regular( + #[cfg(not(target_feature = "sse2"))] + fn find_entry( &self, key_prefix: u64, sub_index: usize,