Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/tl/tlbitfield.h File Reference

#include <lib/sconfig.h>
#include <lib/salloc.h>

Include dependency graph for tlbitfield.h:

Include dependency graph

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

Included by dependency graph

Go to the source code of this file.

Classes

class  TLDynamicBitField
 Dynamic-sized bitfield template. More...

class  TLStaticBitField
 Static bitfield template. More...


Defines

#define _TemplateLibrary_BitField_H_   1

Functions

template<typename T> uint CountBitsSet (T x)
 Count number of bits set in the passed argument.

template<typename T> uint CountBitsCleared (T x)
 Count number of bits cleared (unset) in the passed argument.

template<typename T> int SearchFirstSetBit (T x)
 Search first set bit index.

template<typename T> int SearchFirstClearedBit (T x)
 Search first cleared bit index.


Detailed Description

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This file contains several bitfield templates for space-effcient storage of bits.

Definition in file tlbitfield.h.


Define Documentation

#define _TemplateLibrary_BitField_H_   1
 

Definition at line 19 of file tlbitfield.h.


Function Documentation

template<typename T>
uint CountBitsCleared x  )  [inline]
 

Count number of bits cleared (unset) in the passed argument.

Todo:
Make it work faster (CountBitsCleared; see ...Set()).
See also:
CountBitsSet()

Definition at line 65 of file tlbitfield.h.

References CountBitsSet(), and uint.

Referenced by TLDynamicBitField< T >::CountClr(), and TLStaticBitField< T, N >::CountClr().

template<typename T>
uint CountBitsSet x  )  [inline]
 

Count number of bits set in the passed argument.

Todo:
Make it work faster (CountBitsSet; see function). Use __builtin_popcount,l,ll(x) if available (although "only" equally-fast in i386).
See also:
CountBitsCleared()

Definition at line 43 of file tlbitfield.h.

References uint.

Referenced by CountBitsCleared(), TLDynamicBitField< T >::CountSet(), and TLStaticBitField< T, N >::CountSet().

template<typename T>
int SearchFirstClearedBit x  )  [inline]
 

Search first cleared bit index.

Returns:
The smallest shift value R for which the bit 1<<R is not set in x. Returns -1 if not found.

Todo:
Make it work faster (SearchFirstClearedBit).
See also:
SearchFirstSetBit()

Definition at line 104 of file tlbitfield.h.

Referenced by TLDynamicBitField< T >::SearchFirstClr(), and TLStaticBitField< T, N >::SearchFirstClr().

template<typename T>
int SearchFirstSetBit x  )  [inline]
 

Search first set bit index.

Returns:
The smallest shift value R for which the bit 1<<R is set in x. Returns -1 if not found.

Todo:
Make it work faster (SearchFirstSetBit). Could use a binary-search based method with logarithmic runtime but be careful with MSBfirst vs. LSBfirst.
See also:
SearchFirstClearedBit()

Definition at line 81 of file tlbitfield.h.

Referenced by TLDynamicBitField< T >::SearchFirstSet(), and TLStaticBitField< T, N >::SearchFirstSet().


Generated on Sat Feb 19 22:34:54 2005 for Ray by doxygen 1.3.5