Macros | Functions
IceUtils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ARRAYSIZE(p)   (sizeof(p)/sizeof(p[0]))
 TO BE DOCUMENTED. More...
 
#define END_RUNONCE   __RunOnce__ = true;}}
 
#define IS_ALIGNED_2(x)   ((x&1)==0)
 
#define IS_ALIGNED_4(x)   ((x&3)==0)
 
#define IS_ALIGNED_8(x)   ((x&7)==0)
 
#define OFFSET_OF(Class, Member)   (size_t)&(((Class*)0)->Member)
 TO BE DOCUMENTED. More...
 
#define PREVENT_COPY(cur_class)   private: cur_class(const cur_class& object); cur_class& operator=(const cur_class& object);
 
#define START_RUNONCE   { static bool __RunOnce__ = false; if(!__RunOnce__){
 

Functions

inline_ void _prefetch (void const *ptr)
 
FUNCTION ICECORE_API udword Alignment (udword address)
 
inline_ int ClampToInt16 (int x)
 
inline_ void Compute2DCoords (udword &u, udword &v, udword i, udword nbu)
 
inline_ void Compute3DCoords (udword &u, udword &v, udword &w, udword i, udword nbu, udword nbu_nbv)
 
inline_ udword CountBits (udword n)
 Count the number of '1' bits in a 32 bit word (from Steve Baker's Cute Code Collection) More...
 
inline_ udword CountBits2 (udword bits)
 Even faster? More...
 
inline_ float FeedbackFilter (float val, float &memory, float sharpness)
 
inline_ BOOL HasNullByte (udword x)
 
inline_ bool IsPowerOfTwo (udword n)
 Test to see if a number is an exact power of two (from Steve Baker's Cute Code Collection) More...
 
inline_ udword LowestOneBit (udword w)
 
inline_ sdword min_ (sdword a, sdword b)
 
inline_ udword msb32 (udword x)
 
inline_ udword nlpo2 (udword x)
 
inline_ void ReverseBits (udword &n)
 
inline_ void SetLeastNBits (udword &x, udword n)
 Set the least significant N bits in a word. (from Steve Baker's Cute Code Collection) More...
 
inline_ void SpreadBits (udword &n)
 
inline_ void Swap (udword &x, udword &y)
 
template<class Type >
inline_ Type TClamp (const Type &x, const Type &lo, const Type &hi)
 
template<class Type >
inline_ void TSort (Type &a, Type &b)
 
template<class Type >
inline_ void TSort (Type &a, Type &b, Type &c)
 
template<class Type >
inline_ void TSwap (Type &a, Type &b)
 
inline_ void ZeroLeastSetBit (udword &n)
 Zero the least significant '1' bit in a word. (from Steve Baker's Cute Code Collection) More...
 

Detailed Description

Contains misc. useful macros & defines.

Author
Pierre Terdiman (collected from various sources)
Date
April, 4, 2000

Definition in file IceUtils.h.

Macro Definition Documentation

◆ ARRAYSIZE

#define ARRAYSIZE (   p)    (sizeof(p)/sizeof(p[0]))

TO BE DOCUMENTED.

Definition at line 207 of file IceUtils.h.

◆ END_RUNONCE

#define END_RUNONCE   __RunOnce__ = true;}}

Definition at line 16 of file IceUtils.h.

◆ IS_ALIGNED_2

#define IS_ALIGNED_2 (   x)    ((x&1)==0)

Definition at line 219 of file IceUtils.h.

◆ IS_ALIGNED_4

#define IS_ALIGNED_4 (   x)    ((x&3)==0)

Definition at line 220 of file IceUtils.h.

◆ IS_ALIGNED_8

#define IS_ALIGNED_8 (   x)    ((x&7)==0)

Definition at line 221 of file IceUtils.h.

◆ OFFSET_OF

#define OFFSET_OF (   Class,
  Member 
)    (size_t)&(((Class*)0)->Member)

TO BE DOCUMENTED.

Definition at line 205 of file IceUtils.h.

◆ PREVENT_COPY

#define PREVENT_COPY (   cur_class)    private: cur_class(const cur_class& object); cur_class& operator=(const cur_class& object);

Definition at line 202 of file IceUtils.h.

◆ START_RUNONCE

#define START_RUNONCE   { static bool __RunOnce__ = false; if(!__RunOnce__){

Definition at line 15 of file IceUtils.h.

Function Documentation

◆ _prefetch()

inline_ void _prefetch ( void const ptr)

Definition at line 223 of file IceUtils.h.

◆ Alignment()

FUNCTION ICECORE_API udword Alignment ( udword  address)

◆ ClampToInt16()

inline_ int ClampToInt16 ( int  x)

If you can guarantee that your input domain (i.e. value of x) is slightly limited (abs(x) must be < ((1<<31u)-32767)), then you can use the following code to clamp the resulting value into [-32768,+32767] range:

Definition at line 171 of file IceUtils.h.

◆ Compute2DCoords()

inline_ void Compute2DCoords ( udword u,
udword v,
udword  i,
udword  nbu 
)

Definition at line 238 of file IceUtils.h.

◆ Compute3DCoords()

inline_ void Compute3DCoords ( udword u,
udword v,
udword w,
udword  i,
udword  nbu,
udword  nbu_nbv 
)

Definition at line 250 of file IceUtils.h.

◆ CountBits()

inline_ udword CountBits ( udword  n)

Count the number of '1' bits in a 32 bit word (from Steve Baker's Cute Code Collection)

Definition at line 32 of file IceUtils.h.

◆ CountBits2()

inline_ udword CountBits2 ( udword  bits)

Even faster?

Definition at line 49 of file IceUtils.h.

◆ FeedbackFilter()

inline_ float FeedbackFilter ( float  val,
float &  memory,
float  sharpness 
)

Definition at line 160 of file IceUtils.h.

◆ HasNullByte()

inline_ BOOL HasNullByte ( udword  x)

Definition at line 124 of file IceUtils.h.

◆ IsPowerOfTwo()

inline_ bool IsPowerOfTwo ( udword  n)

Test to see if a number is an exact power of two (from Steve Baker's Cute Code Collection)

Definition at line 87 of file IceUtils.h.

◆ LowestOneBit()

inline_ udword LowestOneBit ( udword  w)

Definition at line 127 of file IceUtils.h.

◆ min_()

inline_ sdword min_ ( sdword  a,
sdword  b 
)

Definition at line 121 of file IceUtils.h.

◆ msb32()

inline_ udword msb32 ( udword  x)

Definition at line 136 of file IceUtils.h.

◆ nlpo2()

inline_ udword nlpo2 ( udword  x)

Definition at line 76 of file IceUtils.h.

◆ ReverseBits()

inline_ void ReverseBits ( udword n)

Reverse all the bits in a 32 bit word (from Steve Baker's Cute Code Collection) (each line can be done in any order.

Definition at line 20 of file IceUtils.h.

◆ SetLeastNBits()

inline_ void SetLeastNBits ( udword x,
udword  n 
)

Set the least significant N bits in a word. (from Steve Baker's Cute Code Collection)

Definition at line 93 of file IceUtils.h.

◆ SpreadBits()

inline_ void SpreadBits ( udword n)

Spread out bits. EG 00001111 -> 0101010101 00001010 -> 0100010000 This is used to interleve to intergers to produce a ‘Morten Key’ used in Space Filling Curves (See DrDobbs Journal, July 1999) Order is important.

Definition at line 62 of file IceUtils.h.

◆ Swap()

inline_ void Swap ( udword x,
udword y 
)

Classic XOR swap (from Steve Baker's Cute Code Collection) x ^= y; /* x' = (x^y) ‍/ y ^= x; / y' = (y^(x^y)) = x ‍/ x ^= y; / x' = (x^y)^x = y *‍/

Definition at line 99 of file IceUtils.h.

◆ TClamp()

template<class Type >
inline_ Type TClamp ( const Type &  x,
const Type &  lo,
const Type &  hi 
)

Definition at line 184 of file IceUtils.h.

◆ TSort() [1/2]

template<class Type >
inline_ void TSort ( Type &  a,
Type &  b 
)

Definition at line 186 of file IceUtils.h.

◆ TSort() [2/2]

template<class Type >
inline_ void TSort ( Type &  a,
Type &  b,
Type &  c 
)

Definition at line 191 of file IceUtils.h.

◆ TSwap()

template<class Type >
inline_ void TSwap ( Type &  a,
Type &  b 
)

Definition at line 183 of file IceUtils.h.

◆ ZeroLeastSetBit()

inline_ void ZeroLeastSetBit ( udword n)

Zero the least significant '1' bit in a word. (from Steve Baker's Cute Code Collection)

Definition at line 90 of file IceUtils.h.



openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:05