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

Functions

inline_ void _prefetch (void const *ptr)
 
inline_ udword abs_ (sdword x)
 Alternative min function. More...
 
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_ char LittleEndian ()
 Alternative abs function. 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...
 

Variables

x = y
 
y = x
 

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

#define __ICEUTILS_H__

Definition at line 14 of file OPC_IceHook.h.

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

TO BE DOCUMENTED.

Definition at line 208 of file OPC_IceHook.h.

#define ARRAYSIZE (   p)    (sizeof(p)/sizeof(p[0]))
#define END_RUNONCE   __RunOnce__ = true;}}

Definition at line 17 of file OPC_IceHook.h.

#define END_RUNONCE   __RunOnce__ = true;}}
#define IS_ALIGNED_2 (   x)    ((x&1)==0)

Definition at line 220 of file OPC_IceHook.h.

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

Definition at line 221 of file OPC_IceHook.h.

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

Definition at line 222 of file OPC_IceHook.h.

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

TO BE DOCUMENTED.

Definition at line 206 of file OPC_IceHook.h.

#define OFFSET_OF (   Class,
  Member 
)    (size_t)&(((Class*)0)->Member)
#define PREVENT_COPY (   cur_class)    private: cur_class(const cur_class& object); cur_class& operator=(const cur_class& object);

Definition at line 203 of file OPC_IceHook.h.

#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__){
#define START_RUNONCE   { static bool __RunOnce__ = false; if(!__RunOnce__){

Definition at line 16 of file OPC_IceHook.h.

Function Documentation

inline_ void _prefetch ( void const ptr)

Definition at line 223 of file IceUtils.h.

inline_ udword abs_ ( sdword  x)

Alternative min function.

Definition at line 118 of file IceUtils.h.

FUNCTION ICECORE_API udword Alignment ( udword  address)
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.

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

Definition at line 238 of file IceUtils.h.

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

Definition at line 250 of file IceUtils.h.

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.

inline_ udword CountBits2 ( udword  bits)

Even faster?

Definition at line 49 of file IceUtils.h.

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

Definition at line 160 of file IceUtils.h.

inline_ BOOL HasNullByte ( udword  x)

Definition at line 124 of file IceUtils.h.

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.

inline_ char LittleEndian ( )

Alternative abs function.

Little/Big endian (from Steve Baker's Cute Code Collection)

Extra comments by Kenny Hoff: Determines the byte-ordering of the current machine (little or big endian) by setting an integer value to 1 (so least significant bit is now 1); take the address of the int and cast to a byte pointer (treat integer as an array of four bytes); check the value of the first byte (must be 0 or 1). If the value is 1, then the first byte least significant byte and this implies LITTLE endian. If the value is 0, the first byte is the most significant byte, BIG endian. Examples: integer 1 on BIG endian: 00000000 00000000 00000000 00000001

integer 1 on LITTLE endian: 00000001 00000000 00000000 00000000

int IsLittleEndian() { int x=1; return ( ((char*)(&x))[0] ); }

Definition at line 115 of file IceUtils.h.

inline_ udword LowestOneBit ( udword  w)

Definition at line 127 of file IceUtils.h.

inline_ sdword min_ ( sdword  a,
sdword  b 
)

Definition at line 121 of file IceUtils.h.

inline_ udword msb32 ( udword  x)

Definition at line 136 of file IceUtils.h.

inline_ udword nlpo2 ( udword  x)

Definition at line 76 of file IceUtils.h.

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.

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.

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.

* inline_ void Swap ( udword x,
udword y 
)

Definition at line 99 of file IceUtils.h.

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

Definition at line 184 of file IceUtils.h.

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

Definition at line 186 of file IceUtils.h.

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

Definition at line 191 of file IceUtils.h.

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

Definition at line 183 of file IceUtils.h.

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.

Variable Documentation

* x = y

Definition at line 98 of file IceUtils.h.

* y = x

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

Definition at line 97 of file IceUtils.h.



openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:42