summaryrefslogtreecommitdiff
path: root/common/lib/libc/string
diff options
context:
space:
mode:
authormatt <matt@NetBSD.org>2015-05-29 19:39:41 +0000
committermatt <matt@NetBSD.org>2015-05-29 19:39:41 +0000
commit32a55c683fd32c2ddd92533d27d7869712c12f73 (patch)
tree442458045d8718bb584741ad2fbb317adbb2985e /common/lib/libc/string
parent92e37ae87d20cecf26c388e53f1c47383e392dcf (diff)
Don't compile if there is a macro of the same name.
Diffstat (limited to 'common/lib/libc/string')
-rw-r--r--common/lib/libc/string/popcount32.c8
-rw-r--r--common/lib/libc/string/popcount64.c9
2 files changed, 12 insertions, 5 deletions
diff --git a/common/lib/libc/string/popcount32.c b/common/lib/libc/string/popcount32.c
index 6913fb8ade8..b23b4da1a38 100644
--- a/common/lib/libc/string/popcount32.c
+++ b/common/lib/libc/string/popcount32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: popcount32.c,v 1.4 2011/08/21 21:25:04 dholland Exp $ */
+/* $NetBSD: popcount32.c,v 1.5 2015/05/29 19:39:41 matt Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: popcount32.c,v 1.4 2011/08/21 21:25:04 dholland Exp $");
+__RCSID("$NetBSD: popcount32.c,v 1.5 2015/05/29 19:39:41 matt Exp $");
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <limits.h>
@@ -43,6 +43,8 @@ __RCSID("$NetBSD: popcount32.c,v 1.4 2011/08/21 21:25:04 dholland Exp $");
#include <machine/limits.h>
#endif
+#ifndef popcount32 // might be a builtin
+
/*
* This a hybrid algorithm for bit counting between parallel counting and
* using multiplication. The idea is to sum up the bits in each Byte, so
@@ -76,3 +78,5 @@ __strong_alias(popcount, popcount32)
#if ULONG_MAX == 0xffffffffU
__strong_alias(popcountl, popcount32)
#endif
+
+#endif /* !popcount32 */
diff --git a/common/lib/libc/string/popcount64.c b/common/lib/libc/string/popcount64.c
index 753fb9bd6e2..3a27c1d039d 100644
--- a/common/lib/libc/string/popcount64.c
+++ b/common/lib/libc/string/popcount64.c
@@ -1,4 +1,4 @@
-/* $NetBSD: popcount64.c,v 1.7 2012/03/09 15:41:16 christos Exp $ */
+/* $NetBSD: popcount64.c,v 1.8 2015/05/29 19:39:41 matt Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: popcount64.c,v 1.7 2012/03/09 15:41:16 christos Exp $");
+__RCSID("$NetBSD: popcount64.c,v 1.8 2015/05/29 19:39:41 matt Exp $");
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <limits.h>
@@ -43,9 +43,11 @@ __RCSID("$NetBSD: popcount64.c,v 1.7 2012/03/09 15:41:16 christos Exp $");
#include <machine/limits.h>
#endif
+#ifndef popcount64 // might be defined to use a __builtin
+
/*
* If uint64_t is larger than size_t, the follow assumes that
- * splitting into 32bit halfes is faster.
+ * splitting into 32bit halves is faster.
*
* The native pocount64 version is based on the same ideas as popcount32(3),
* see popcount32.c for comments.
@@ -83,3 +85,4 @@ __strong_alias(popcountl, popcount64)
__strong_alias(popcountll, popcount64)
#endif
+#endif /* !popcount64 */