]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
add simd_onebit_masks as static in arm simd_utils.h as well
authorKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Fri, 8 Oct 2021 22:12:24 +0000 (22:12 +0000)
committerKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Tue, 12 Oct 2021 08:51:35 +0000 (11:51 +0300)
src/util/arch/arm/simd_utils.h
src/util/arch/x86/simd_utils.h

index a2f79774fcadcedbdd1165283a1c3d30e8b48501..052319f6e6d7cc2816028bc1de64dca7485c37db 100644 (file)
 
 #include <string.h> // for memcpy
 
+#define ZEROES_8 0, 0, 0, 0, 0, 0, 0, 0
+#define ZEROES_31 ZEROES_8, ZEROES_8, ZEROES_8, 0, 0, 0, 0, 0, 0, 0
+#define ZEROES_32 ZEROES_8, ZEROES_8, ZEROES_8, ZEROES_8
+
+/** \brief LUT for the mask1bit functions. */
+ALIGN_CL_DIRECTIVE static const u8 simd_onebit_masks[] = {
+    ZEROES_32, ZEROES_32,
+    ZEROES_31, 0x01, ZEROES_32,
+    ZEROES_31, 0x02, ZEROES_32,
+    ZEROES_31, 0x04, ZEROES_32,
+    ZEROES_31, 0x08, ZEROES_32,
+    ZEROES_31, 0x10, ZEROES_32,
+    ZEROES_31, 0x20, ZEROES_32,
+    ZEROES_31, 0x40, ZEROES_32,
+    ZEROES_31, 0x80, ZEROES_32,
+    ZEROES_32, ZEROES_32,
+};
+
 static really_inline m128 ones128(void) {
     return (m128) vdupq_n_s8(0xFF);
 }
@@ -343,14 +361,6 @@ m128 variable_byte_shift_m128(m128 in, s32 amount) {
     }
 }
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern const u8 simd_onebit_masks[];
-#ifdef __cplusplus
-}
-#endif
-
 static really_inline
 m128 mask1bit128(unsigned int n) {
     assert(n < sizeof(m128) * 8);
index 24c1abe013bba5c8c72afc759b0f294f385df55f..b36d5a385c489814c9c4124c28806080d162a88f 100644 (file)
@@ -58,6 +58,7 @@ ALIGN_CL_DIRECTIVE static const u8 simd_onebit_masks[] = {
     ZEROES_31, 0x80, ZEROES_32,
     ZEROES_32, ZEROES_32,
 };
+
 static really_inline m128 ones128(void) {
 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
     /* gcc gets this right */