summaryrefslogtreecommitdiff
path: root/emulators/libretro-mgba/patches/patch-include_mgba-util_math.h
diff options
context:
space:
mode:
Diffstat (limited to 'emulators/libretro-mgba/patches/patch-include_mgba-util_math.h')
-rw-r--r--emulators/libretro-mgba/patches/patch-include_mgba-util_math.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/emulators/libretro-mgba/patches/patch-include_mgba-util_math.h b/emulators/libretro-mgba/patches/patch-include_mgba-util_math.h
new file mode 100644
index 00000000000..65ef848ac4b
--- /dev/null
+++ b/emulators/libretro-mgba/patches/patch-include_mgba-util_math.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-include_mgba-util_math.h,v 1.1 2018/08/12 14:25:09 nia Exp $
+
+NetBSD defines popcount32 in libc.
+
+--- include/mgba-util/math.h.orig 2017-07-16 19:04:50.000000000 +0000
++++ include/mgba-util/math.h
+@@ -10,11 +10,15 @@
+
+ CXX_GUARD_START
+
++#ifndef __NetBSD__
+ static inline uint32_t popcount32(unsigned bits) {
+ bits = bits - ((bits >> 1) & 0x55555555);
+ bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
+ return (((bits + (bits >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
+ }
++#else
++unsigned int popcount32(uint32_t);
++#endif
+
+ static inline unsigned clz32(uint32_t bits) {
+ #if defined(__GNUC__) || __clang__