Libraries updates and cleanup
* Updating common/lib * Updating lib/csu * Updating lib/libc * Updating libexec/ld.elf_so * Corrected test on __minix in featuretest to actually follow the meaning of the comment. * Cleaned up _REENTRANT-related defintions. * Disabled -D_REENTRANT for libfetch * Removing some unneeded __NBSD_LIBC defines and tests Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: popcount64.c,v 1.5 2009/08/05 15:04:15 joerg Exp $ */
|
||||
/* $NetBSD: popcount64.c,v 1.7 2012/03/09 15:41:16 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@@ -32,10 +32,11 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: popcount64.c,v 1.5 2009/08/05 15:04:15 joerg Exp $");
|
||||
__RCSID("$NetBSD: popcount64.c,v 1.7 2012/03/09 15:41:16 christos Exp $");
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <strings.h>
|
||||
#else
|
||||
#include <lib/libkern/libkern.h>
|
||||
@@ -63,10 +64,12 @@ popcount64(uint64_t v)
|
||||
{
|
||||
unsigned int c;
|
||||
|
||||
v = v - ((v >> 1) & 0x5555555555555555ULL);
|
||||
v = (v & 0x3333333333333333ULL) + ((v >> 2) & 0x3333333333333333ULL);
|
||||
v = ((v + (v >> 4)) & 0x0f0f0f0f0f0f0f0fULL) * 0x0101010101010101ULL;
|
||||
c = v >> 56;
|
||||
v = v - ((v >> 1) & (uint64_t)0x5555555555555555ULL);
|
||||
v = (v & (uint64_t)0x3333333333333333ULL) +
|
||||
((v >> 2) & (uint64_t)0x3333333333333333ULL);
|
||||
v = ((v + (v >> 4)) & (uint64_t)0x0f0f0f0f0f0f0f0fULL) *
|
||||
(uint64_t)0x0101010101010101ULL;
|
||||
c = (unsigned int)(v >> 56);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user