/*
* popcount . h
*
* This header file contains various declaration for population count
*
* Version Log :
* 0 . 1 18 March 2008 ( first released to public - - GUAVA 3 . 3 )
*
* CJ , Tjhai
* email : ctjhai @ plymouth . ac . uk
* Homepage : www . plymouth . ac . uk / staff / ctjhai
*
*/
#ifndef _POPCOUNT_H
#define _POPCOUNT_H
#include "config.h"
/* Global variable -- only used for LUT-based popcount */
#if defined (POPCOUNT_LUT8) || defined (POPCOUNT_LUT16)
extern unsigned short *__popcnt_LUT;
#endif
/* Function prototypes */
void init_popcount(void );
void __init_popcount_LUT(void );
void clear_popcount(void );
void __clear_popcount_LUT(void );
/* The following contains the macros that actually do the population count */
#if defined (POPCOUNT_LUT8) /* 8-bit LUT */
# if BITS_PER_LONG == 64 /* 64-bit machine */
# define popcount(__v) (__popcnt_LUT[__v & 0 xFFUL] + __popcnt_LUT[(__v>>8 ) & 0 xFFUL] + \
__popcnt_LUT[(__v>>16 ) & 0 xFFUL] + __popcnt_LUT[(__v>>24 ) & 0 xFFUL] + \
__popcnt_LUT[(__v>>32 ) & 0 xFFUL] + __popcnt_LUT[(__v>>40 ) & 0 xFFUL] + \
__popcnt_LUT[(__v>>48 ) & 0 xFFUL] + __popcnt_LUT[(__v>>56 ) & 0 xFFUL])
# else /* 32-bit machine */
# define popcount(__v) (__popcnt_LUT[__v & 0 xFFU] + __popcnt_LUT[(__v>>8 ) & 0 xFFU] + \
__popcnt_LUT[(__v>>16 ) & 0 xFFU] + __popcnt_LUT[(__v>>24 ) & 0 xFFU])
# endif
#elif defined (POPCOUNT_LUT16) /* 16-bit LUT */
# if BITS_PER_LONG == 64 /* 64-bit machine */
# define popcount(__v) (__popcnt_LUT[__v & 0 xFFFFUL] + __popcnt_LUT[(__v>>16 ) & 0 xFFFFUL] + \
__popcnt_LUT[(__v>>32 ) & 0 xFFFFUL] + __popcnt_LUT[(__v>>48 ) & 0 xFFFFUL])
# else /* 32-bit machine */
# define popcount(__v) (__popcnt_LUT[__v & 0 xFFFFU] + __popcnt_LUT[(__v>>16 ) & 0 xFFFFU])
# endif
#elif defined (POPCOUNT_STD)
unsigned int popcount(unsigned long x);
#endif
#endif /* _POPCOUNT_H */
Messung V0.5 in Prozent C=85 H=92 G=88
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-06-18)
¤
*© Formatika GbR, Deutschland