]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
incremental improvement in cleanliness
authorG.E. <gregory.economou@vectorcamp.gr>
Tue, 12 Mar 2024 10:37:08 +0000 (12:37 +0200)
committerG.E. <gregory.economou@vectorcamp.gr>
Tue, 12 Mar 2024 10:37:08 +0000 (12:37 +0200)
cmake/cflags-generic.cmake
cmake/osdetection.cmake
src/util/arch.h
src/util/popcount.h

index 29b746a1990b8e6857c13ba93bf961b98614edd5..93fa789da210cf13ce6908527f323907f7b0cf1f 100644 (file)
@@ -27,6 +27,10 @@ CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
 CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
 CHECK_FUNCTION_EXISTS(_aligned_malloc HAVE__ALIGNED_MALLOC)
 
+if(FREEBSD OR NETBSD)
+    set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -gdwarf-4")
+endif()
+
 # these end up in the config file
 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
 CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
index e4d0bf5785fe4bf46a17b0c23af93dc9d5423b68..0e730fe38315f882b6f4d33bac95127fb90bae23 100644 (file)
@@ -6,6 +6,10 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
     set(FREEBSD true)
 endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
 
+if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+    set(NETBSD true)
+endif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+
 if (LINUX AND (ARCH_IA32 OR ARCH_X86_64))
   option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
 else()
index 1e8d2fbd4464e7aa827d86a1e7c7d93fe5a34155..9a9dde1bdf9867595e106b2eff231ecf15fe0ba2 100644 (file)
 #elif defined(ARCH_PPC64EL)
 #include "util/arch/ppc64el/ppc64el.h"
 #endif
+#ifdef __NetBSD__
+#include <strings.h>
+#define HAVE_LOCAL_POPCOUNT
+#endif
 
 #endif // UTIL_ARCH_X86_H_
 
index e9f689e900172b281b2b84cca702cd63ce0205a2..a02e3bc56075a8dbefab2bbd7bc6c9434d0dfd4c 100644 (file)
 
 #include "ue2common.h"
 #include "util/arch.h"
-#ifdef __NetBSD__
-#include <strings.h>
-#endif
 
-
-#ifndef __NetBSD__
+#ifndef HAVE_LOCAL_POPCOUNT
 static really_inline
 u32 popcount32(u32 x) {
     return __builtin_popcount(x);
@@ -56,7 +52,7 @@ u32 popcount32(u32 x) {
 //     return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
 // #endif
 }
-#endif /* __NetBSD__ */
+#endif /* HAVE_LOCAL_POPCOUNT */
 
 static really_inline
 u32 popcount32x4(u32 const *x) {
@@ -67,7 +63,7 @@ u32 popcount32x4(u32 const *x) {
     return sum;
 }
 
-#ifndef __NetBSD__
+#ifndef HAVE_LOCAL_POPCOUNT
 static really_inline
 u32 popcount64(u64a x) {
     return __builtin_popcountll(x);
@@ -88,7 +84,7 @@ u32 popcount64(u64a x) {
 //     return popcount32(x >> 32) + popcount32(x);
 // #endif
 }
-#endif /* __NetBSD__ */
+#endif /* HAVE_LOCAL_POPCOUNT */
 
 static really_inline
 u32 popcount64x4(u64a const *x) {