mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
moved HAVE_BUILTIN_POPCOUNT def to cmake
This commit is contained in:
parent
226645eaf1
commit
0045a2bdc7
@ -115,6 +115,8 @@ Assuming an existing HomeBrew installation:
|
|||||||
|
|
||||||
### *BSD
|
### *BSD
|
||||||
In NetBSD you will almost certainly need to have a newer compiler installed.
|
In NetBSD you will almost certainly need to have a newer compiler installed.
|
||||||
|
This will not replace the one in the standard base distribution, and
|
||||||
|
cmake will probably find the wrong compiler when it checks automatically.
|
||||||
Using the example of gcc12 from pkgsrc, one will need to set two
|
Using the example of gcc12 from pkgsrc, one will need to set two
|
||||||
environment variables before starting:
|
environment variables before starting:
|
||||||
```
|
```
|
||||||
@ -123,7 +125,11 @@ export CXX="/usr/pkg/gcc12/bin/g++"
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
In FreeBSD similarly, using gcc12 from pkg
|
In FreeBSD similarly, if you install another compiler, cmake might not
|
||||||
|
find the right one. Worse is if it finds, say, g++ and configures it for
|
||||||
|
C++ but leaves cc for C - FreeBSD's default cc is clang, and the binaries
|
||||||
|
generated between g++ and clang will not play nicely together.
|
||||||
|
Using the example of gcc12 from pkg:
|
||||||
```
|
```
|
||||||
export CC="/usr/local/bin/gcc"
|
export CC="/usr/local/bin/gcc"
|
||||||
export CXX="/usr/local/bin/g++"
|
export CXX="/usr/local/bin/g++"
|
||||||
|
@ -31,6 +31,11 @@ if(FREEBSD OR NETBSD)
|
|||||||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -gdwarf-4")
|
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -gdwarf-4")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NETBSD)
|
||||||
|
set(EXTRA_C_FLAGS "${EXTRA_CXX_FLAGS} -DHAVE_BUILTIN_POPCOUNT")
|
||||||
|
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -DHAVE_BUILTIN_POPCOUNT")
|
||||||
|
endif()
|
||||||
|
|
||||||
# these end up in the config file
|
# these end up in the config file
|
||||||
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
|
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
|
||||||
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
|
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#ifdef __NetBSD__
|
#ifdef __NetBSD__
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#define HAVE_LOCAL_POPCOUNT
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // UTIL_ARCH_X86_H_
|
#endif // UTIL_ARCH_X86_H_
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#include "util/arch.h"
|
#include "util/arch.h"
|
||||||
|
|
||||||
#ifndef HAVE_LOCAL_POPCOUNT
|
#ifndef HAVE_BUILTIN_POPCOUNT
|
||||||
static really_inline
|
static really_inline
|
||||||
u32 popcount32(u32 x) {
|
u32 popcount32(u32 x) {
|
||||||
return __builtin_popcount(x);
|
return __builtin_popcount(x);
|
||||||
@ -52,7 +52,7 @@ u32 popcount32(u32 x) {
|
|||||||
// return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
|
// return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LOCAL_POPCOUNT */
|
#endif /* HAVE_BUILTIN_POPCOUNT */
|
||||||
|
|
||||||
static really_inline
|
static really_inline
|
||||||
u32 popcount32x4(u32 const *x) {
|
u32 popcount32x4(u32 const *x) {
|
||||||
@ -63,7 +63,7 @@ u32 popcount32x4(u32 const *x) {
|
|||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_LOCAL_POPCOUNT
|
#ifndef HAVE_BUILTIN_POPCOUNT
|
||||||
static really_inline
|
static really_inline
|
||||||
u32 popcount64(u64a x) {
|
u32 popcount64(u64a x) {
|
||||||
return __builtin_popcountll(x);
|
return __builtin_popcountll(x);
|
||||||
@ -84,7 +84,7 @@ u32 popcount64(u64a x) {
|
|||||||
// return popcount32(x >> 32) + popcount32(x);
|
// return popcount32(x >> 32) + popcount32(x);
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LOCAL_POPCOUNT */
|
#endif /* HAVE_BUILTIN_POPCOUNT */
|
||||||
|
|
||||||
static really_inline
|
static really_inline
|
||||||
u32 popcount64x4(u64a const *x) {
|
u32 popcount64x4(u64a const *x) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user