Don't compile if there is a macro of the same name.

This commit is contained in:
matt 2015-05-29 19:39:41 +00:00
parent c98065b9f6
commit 6ac68d00a5
2 changed files with 12 additions and 5 deletions

View File

@ -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 */

View File

@ -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 */