GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LDT / V0-4-0

Constituent: test_rl     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

BIT.h File Reference

Utility routines to manipulate 16 and 32 bit words. More...

This graph shows which files directly or indirectly include this file:


Defines

#define BW_(x)
 Replaces each 4-bit sequence in arg by the number of bits in sequence.
#define BS_(x)
 Replaces each 4-bit sequence in arg by the number of bits in sequence.

Functions

static __inline
unsigned int 
BIT__countW (unsigned int w)
 Computes the number of bits set (1) in 32-bit argument.
static __inline
unsigned int 
BIT__countS (unsigned short int s)
 Computes the number of bits set (1) in 16-bit argument.
static __inline
unsigned int 
BIT__countB (unsigned char c)
 Computes the number of bits set (1) in 8-bit argument.

Detailed Description

Utility routines to manipulate 16 and 32 bit words.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: BIT.h,v 1.2 2009/04/29 23:01:53 russell Exp $

Define Documentation

#define BS_ (  ) 

Value:

((x) - (((x)>>1)&0x7777)                        \
                               - (((x)>>2)&0x3333)                        \
                               - (((x)>>3)&0x1111))
Replaces each 4-bit sequence in arg by the number of bits in sequence.

See also:
BIT_countS
Replaces each 4-bit sequence in 16-bit argument by the number of bits in that sequence (which will, of course, fit in 4 bits).

Warning:
This is not a public macro, it used only to implement BIT32_count

#define BW_ (  ) 

Value:

((x) - (((x)>>1)&0x77777777)                    \
                               - (((x)>>2)&0x33333333)                    \
                               - (((x)>>3)&0x11111111))
Replaces each 4-bit sequence in arg by the number of bits in sequence.

See also:
BIT_countW
Replaces each 4-bit sequence in 32-bit argument by the number of bits in that sequence (which will, of course, fit in 4 bits).

Warning:
This is not a public macro, it used only to implement BIT32_count


Function Documentation

static __inline unsigned int BIT__countB ( unsigned char  c  )  [static]

Computes the number of bits set (1) in 8-bit argument.

Returns:
The number of set bits
Parameters:
c The character to count the bits in
The algorithm is to do this in two 4-bit chunks, where the nibbles are used to access an array of 16 x 2 bit values. 2* nibble-1 is used as an index the array. The array itself holds the count, except the value 0xf must be special cased, since the number of bits is 4, a value that is unable to fit into 2 bits.

static __inline unsigned int BIT__countS ( unsigned short int  s  )  [static]

Computes the number of bits set (1) in 16-bit argument.

See also:
BS_
Credit to Chris Smith (original algorithm) Jane Huffman (original writer) Brad Merril & Jerry Leichter (ported from 36-bit words to 32-bit words)

static __inline unsigned int BIT__countW ( unsigned int  w  )  [static]

Computes the number of bits set (1) in 32-bit argument.

See also:
BW_
Credit to Chris Smith (original algorithm) Jane Huffman (original writer) Brad Merril & Jerry Leichter (ported from 36-bit words to 32-bit words)


Generated on Fri Jun 19 01:47:31 2009 by  doxygen 1.5.3