support building on NetBSD

This commit is contained in:
G.E.
2024-03-06 10:48:56 +01:00
parent 71f3e7d994
commit 12f61d15ed
5 changed files with 34 additions and 1 deletions

View File

@@ -36,7 +36,12 @@
#include "ue2common.h"
#include "util/arch.h"
#ifdef __NetBSD__
#include <strings.h>
#endif
#ifndef __NetBSD__
static really_inline
u32 popcount32(u32 x) {
return __builtin_popcount(x);
@@ -51,6 +56,7 @@ u32 popcount32(u32 x) {
// return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
// #endif
}
#endif /* __NetBSD__ */
static really_inline
u32 popcount32x4(u32 const *x) {
@@ -61,6 +67,7 @@ u32 popcount32x4(u32 const *x) {
return sum;
}
#ifndef __NetBSD__
static really_inline
u32 popcount64(u64a x) {
return __builtin_popcountll(x);
@@ -81,6 +88,7 @@ u32 popcount64(u64a x) {
// return popcount32(x >> 32) + popcount32(x);
// #endif
}
#endif /* __NetBSD__ */
static really_inline
u32 popcount64x4(u64a const *x) {