]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
remove unneeded shifts
authorKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Mon, 18 Dec 2023 18:46:36 +0000 (20:46 +0200)
committerKonstantinos Margaritis <konma@vectorcamp.gr>
Thu, 21 Dec 2023 23:25:20 +0000 (23:25 +0000)
src/hwlm/noodle_engine_simd.hpp
src/util/supervector/supervector.hpp

index 9e16c2f370b78a90d2174ca3bd3cf3ea08439fc5..9af76768cf6f25967b7586d65475711da704a147 100644 (file)
@@ -37,7 +37,7 @@ static really_really_inline
 hwlm_error_t single_zscan(const struct noodTable *n,const u8 *d, const u8 *buf,
                           typename SuperVector<S>::comparemask_type z, size_t len, const struct cb_info *cbi) {
     while (unlikely(z)) {
-        typename SuperVector<S>::comparemask_type pos = SuperVector<S>::findLSB(z) >> Z_POSSHIFT;
+        typename SuperVector<S>::comparemask_type pos = SuperVector<S>::findLSB(z);
         size_t matchPos = d - buf + pos;
         DEBUG_PRINTF("match pos %zu\n", matchPos);
         hwlmcb_rv_t rv = final(n, buf, len, n->msk_len != 1, cbi, matchPos);
@@ -51,7 +51,7 @@ static really_really_inline
 hwlm_error_t double_zscan(const struct noodTable *n,const u8 *d, const u8 *buf,
                           typename SuperVector<S>::comparemask_type z, size_t len, const struct cb_info *cbi) {
     while (unlikely(z)) {
-        typename SuperVector<S>::comparemask_type pos = SuperVector<S>::findLSB(z) >> Z_POSSHIFT;
+        typename SuperVector<S>::comparemask_type pos = SuperVector<S>::findLSB(z);
         size_t matchPos = d - buf + pos - 1;
         DEBUG_PRINTF("match pos %zu\n", matchPos);
         hwlmcb_rv_t rv = final(n, buf, len, true, cbi, matchPos);
index 1d72ee81f4c79374e6f93cd99abe64d78c164838..3c4b1eea04cf146951cc41f65b6f58294027b395 100644 (file)
 
 #include <util/bitutils.h>
 
-#if defined(HAVE_SIMD_512_BITS)
-#define Z_POSSHIFT 0
-#elif defined(HAVE_SIMD_256_BITS)
-#define Z_POSSHIFT 0
-#elif defined(HAVE_SIMD_128_BITS)
-#if !defined(VS_SIMDE_BACKEND) && (defined(ARCH_ARM32) || defined(ARCH_AARCH64))
-#define Z_POSSHIFT 2
-#else
-#define Z_POSSHIFT 0
-#endif
-#endif
-
 // Define a common assume_aligned using an appropriate compiler built-in, if
 // it's available. Note that we need to handle C or C++ compilation.
 #ifdef __cplusplus