Module Name: src
Committed By: matt
Date: Fri May 29 19:39:41 UTC 2015
Modified Files:
src/common/lib/libc/string: popcount32.c popcount64.c
Log Message:
Don't compile if there is a macro of the same name.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/string/popcount32.c
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/string/popcount64.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libc/string/popcount32.c
diff -u src/common/lib/libc/string/popcount32.c:1.4 src/common/lib/libc/string/popcount32.c:1.5
--- src/common/lib/libc/string/popcount32.c:1.4 Sun Aug 21 21:25:04 2011
+++ src/common/lib/libc/string/popcount32.c Fri May 29 19:39:41 2015
@@ -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 201
#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 */
Index: src/common/lib/libc/string/popcount64.c
diff -u src/common/lib/libc/string/popcount64.c:1.7 src/common/lib/libc/string/popcount64.c:1.8
--- src/common/lib/libc/string/popcount64.c:1.7 Fri Mar 9 15:41:16 2012
+++ src/common/lib/libc/string/popcount64.c Fri May 29 19:39:41 2015
@@ -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 201
#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 */