eg_bit.c File Reference

#include "eg_bit.h"

Include dependency graph for eg_bit.c:

Go to the source code of this file.

Defines

#define EGBIT_COUNT(x, c)   ((x) & EGBIT_MASK(c)) + (((x) >> (EGBIT_TWO(c))) & EGBIT_MASK(c))
#define EGBIT_MASK(c)   (((unsigned int)(-1)) / (EGBIT_TWO(EGBIT_TWO(c)) + 1u))
#define EGBIT_TWO(c)   (0x1u << (c))

Functions

int EGbitAnd (EGbitset_t *dst, const EGbitset_t *src, const unsigned int from, const unsigned int to)
int EGbitCopy (bit_int_t *const a, const bit_int_t *const b, const unsigned int from, const unsigned int to)
EGbitset_t EGbitCount (bit_int_t *bitset, const unsigned int from, const unsigned int to)
 Count the number of on-bits in a bit-map.
EGbitset_t EGbitElemBitCount (EGbitset_t n)
 Count number of on bits on 32-bit integers.
int EGbitIsEqual (const bit_int_t *a, const bit_int_t *b, const unsigned int from, const unsigned int to)
int EGbitIsLeq (const bit_int_t *a, const bit_int_t *b, const unsigned int from, const unsigned int to)
int EGbitLeftShift (bit_int_t *dst, const bit_int_t *src, const unsigned int shift, const unsigned int from, const unsigned int to)
unsigned int EGbitNext (const EGbitset_t *dst, const unsigned int pos, const unsigned int size)
int EGbitOr (EGbitset_t *dst, const EGbitset_t *src, const unsigned int from, const unsigned int to)
int EGbitPlus (bit_int_t *dst, const bit_int_t *src, const unsigned int from, const unsigned int to)
unsigned int EGbitPrev (const EGbitset_t *dst, const unsigned int pos)
int EGbitReset (EGbitset_t *dst, const unsigned int from, const unsigned int to)
int EGbitRightShift (bit_int_t *dst, const bit_int_t *src, const unsigned int shift, const unsigned int from, const unsigned int to)
int EGbitSanity (void)
int EGbitSet (EGbitset_t *const dst, const unsigned int pos)
int EGbitTest (EGbitset_t const *const dst, const unsigned int pos)
int EGbitUnset (bit_int_t *dst, const unsigned int pos)
int EGbitXor (EGbitset_t *dst, const EGbitset_t *src, const unsigned int from, const unsigned int to)
void EGfreeBitSet (void *bitfield, const size_t size, EGmemPool_t *mem)
EGbitset_tEGnewBitSet (EGmemPool_t *mem, size_t *n)


Define Documentation

#define EGBIT_COUNT x,
 )     ((x) & EGBIT_MASK(c)) + (((x) >> (EGBIT_TWO(c))) & EGBIT_MASK(c))
 

#define EGBIT_MASK  )     (((unsigned int)(-1)) / (EGBIT_TWO(EGBIT_TWO(c)) + 1u))
 

#define EGBIT_TWO  )     (0x1u << (c))
 


Function Documentation

int EGbitAnd EGbitset_t dst,
const EGbitset_t src,
const unsigned int  from,
const unsigned int  to
 

Definition at line 234 of file eg_bit.c.

int EGbitCopy bit_int_t *const   a,
const bit_int_t *const   b,
const unsigned int  from,
const unsigned int  to
 

Definition at line 83 of file eg_bit.c.

EGbitset_t EGbitCount bit_int_t bitset,
const unsigned int  from,
const unsigned int  to
 

Count the number of on-bits in a bit-map.

Definition at line 608 of file eg_bit.c.

Here is the call graph for this function:

EGbitset_t EGbitElemBitCount EGbitset_t  n  ) 
 

Count number of on bits on 32-bit integers.

Returns:
Number of on bits in the given 32-bit integer
Description:
Parallel Count carries out bit counting in a parallel fashion. Consider n after the first line has finished executing. Imagine splitting n into pairs of bits. Each pair contains the number of ones in those two bit positions in the original n. After the second line has finished executing, each nibble contains the number of ones in those four bits positions in the original n. Continuing this for five iterations, the 64 bits contain the number of ones among these sixty-four bit positions in the original n. That is what we wanted to compute.

Definition at line 588 of file eg_bit.c.

int EGbitIsEqual const bit_int_t a,
const bit_int_t b,
const unsigned int  from,
const unsigned int  to
 

Definition at line 126 of file eg_bit.c.

int EGbitIsLeq const bit_int_t a,
const bit_int_t b,
const unsigned int  from,
const unsigned int  to
 

Definition at line 100 of file eg_bit.c.

int EGbitLeftShift bit_int_t dst,
const bit_int_t src,
const unsigned int  shift,
const unsigned int  from,
const unsigned int  to
 

Definition at line 147 of file eg_bit.c.

unsigned int EGbitNext const EGbitset_t dst,
const unsigned int  pos,
const unsigned int  size
 

Definition at line 364 of file eg_bit.c.

int EGbitOr EGbitset_t dst,
const EGbitset_t src,
const unsigned int  from,
const unsigned int  to
 

Definition at line 215 of file eg_bit.c.

int EGbitPlus bit_int_t dst,
const bit_int_t src,
const unsigned int  from,
const unsigned int  to
 

Definition at line 49 of file eg_bit.c.

unsigned int EGbitPrev const EGbitset_t dst,
const unsigned int  pos
 

Definition at line 315 of file eg_bit.c.

int EGbitReset EGbitset_t dst,
const unsigned int  from,
const unsigned int  to
 

Definition at line 272 of file eg_bit.c.

int EGbitRightShift bit_int_t dst,
const bit_int_t src,
const unsigned int  shift,
const unsigned int  from,
const unsigned int  to
 

Definition at line 22 of file eg_bit.c.

int EGbitSanity void   ) 
 

Definition at line 414 of file eg_bit.c.

Here is the call graph for this function:

int EGbitSet EGbitset_t *const   dst,
const unsigned int  pos
 

Definition at line 302 of file eg_bit.c.

int EGbitTest EGbitset_t const *const   dst,
const unsigned int  pos
 

Definition at line 291 of file eg_bit.c.

int EGbitUnset bit_int_t dst,
const unsigned int  pos
 

Definition at line 182 of file eg_bit.c.

int EGbitXor EGbitset_t dst,
const EGbitset_t src,
const unsigned int  from,
const unsigned int  to
 

Definition at line 253 of file eg_bit.c.

void EGfreeBitSet void *  bitfield,
const size_t  size,
EGmemPool_t mem
 

Definition at line 173 of file eg_bit.c.

EGbitset_t* EGnewBitSet EGmemPool_t mem,
size_t *  n
 

Definition at line 195 of file eg_bit.c.


Generated on Mon Jan 30 08:49:13 2006 for EGlib by  doxygen 1.4.5