Go to the documentation of this file.
12 #ifndef __ICEUTILS_H__
13 #define __ICEUTILS_H__
15 #define START_RUNONCE { static bool __RunOnce__ = false; if(!__RunOnce__){
16 #define END_RUNONCE __RunOnce__ = true;}}
22 n = ((
n >> 1) & 0x55555555) | ((
n << 1) & 0xaaaaaaaa);
23 n = ((
n >> 2) & 0x33333333) | ((
n << 2) & 0xcccccccc);
24 n = ((
n >> 4) & 0x0f0f0f0f) | ((
n << 4) & 0xf0f0f0f0);
25 n = ((
n >> 8) & 0x00ff00ff) | ((
n << 8) & 0xff00ff00);
26 n = ((
n >> 16) & 0x0000ffff) | ((
n << 16) & 0xffff0000);
38 n = (
n & 0x55555555) + ((
n & 0xaaaaaaaa) >> 1);
39 n = (
n & 0x33333333) + ((
n & 0xcccccccc) >> 2);
40 n = (
n & 0x0f0f0f0f) + ((
n & 0xf0f0f0f0) >> 4);
41 n = (
n & 0x00ff00ff) + ((
n & 0xff00ff00) >> 8);
42 n = (
n & 0x0000ffff) + ((
n & 0xffff0000) >> 16);
51 bits = bits - ((bits >> 1) & 0x55555555);
52 bits = ((bits >> 2) & 0x33333333) + (bits & 0x33333333);
53 bits = ((bits >> 4) + bits) & 0x0F0F0F0F;
54 return (bits * 0x01010101) >> 24;
64 n = (
n & 0x0000ffff) | ((
n & 0xffff0000) << 16);
65 n = (
n & 0x000000ff) | ((
n & 0x0000ff00) << 8);
66 n = (
n & 0x000f000f) | ((
n & 0x00f000f0) << 4);
67 n = (
n & 0x03030303) | ((
n & 0x0c0c0c0c) << 2);
68 n = (
n & 0x11111111) | ((
n & 0x22222222) << 1);
115 inline_ char LittleEndian() {
int i = 1;
return *((
char*)&
i); }
143 return (x & ~(x >> 1));
162 ASSERT(sharpness>=0.0
f && sharpness<=1.0
f &&
"Invalid sharpness value in feedback filter");
163 if(sharpness<0.0
f) sharpness = 0.0f;
164 else if(sharpness>1.0
f) sharpness = 1.0f;
165 return memory =
val * sharpness + memory * (1.0f - sharpness);
175 int delta = 32767 - x;
176 x += (delta>>31) & delta;
178 x -= (delta>>31) & delta;
184 template<
class Type>
inline_ Type
TClamp(
const Type& x,
const Type& lo,
const Type& hi) {
return ((x<lo) ? lo : (x>hi) ? hi : x); }
202 #define PREVENT_COPY(cur_class) private: cur_class(const cur_class& object); cur_class& operator=(const cur_class& object);
205 #define OFFSET_OF(Class, Member) (size_t)&(((Class*)0)->Member)
206 #define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
219 #define IS_ALIGNED_2(x) ((x&1)==0)
220 #define IS_ALIGNED_4(x) ((x&3)==0)
221 #define IS_ALIGNED_8(x) ((x&7)==0)
256 #endif // __ICEUTILS_H__
inline_ udword CountBits2(udword bits)
Even faster?
inline_ sdword min_(sdword a, sdword b)
inline_ udword nlpo2(udword x)
inline_ void Compute3DCoords(udword &u, udword &v, udword &w, udword i, udword nbu, udword nbu_nbv)
inline_ void SetLeastNBits(udword &x, udword n)
Set the least significant N bits in a word. (from Steve Baker's Cute Code Collection)
inline_ void TSort(Type &a, Type &b)
inline_ bool IsPowerOfTwo(udword n)
Test to see if a number is an exact power of two (from Steve Baker's Cute Code Collection)
FUNCTION ICECORE_API udword Alignment(udword address)
inline_ BOOL HasNullByte(udword x)
inline_ udword LowestOneBit(udword w)
unsigned int udword
sizeof(udword) must be 4
inline_ void TSwap(Type &a, Type &b)
int BOOL
Another boolean type.
inline_ void _prefetch(void const *ptr)
inline_ void ZeroLeastSetBit(udword &n)
Zero the least significant '1' bit in a word. (from Steve Baker's Cute Code Collection)
inline_ float FeedbackFilter(float val, float &memory, float sharpness)
inline_ void Compute2DCoords(udword &u, udword &v, udword i, udword nbu)
inline_ void Swap(udword &x, udword &y)
inline_ udword msb32(udword x)
inline_ int ClampToInt16(int x)
inline_ void SpreadBits(udword &n)
typedef void(PNGAPI *png_error_ptr) PNGARG((png_structp
signed int sdword
sizeof(sdword) must be 4
inline_ void ReverseBits(udword &n)
inline_ udword CountBits(udword n)
Count the number of '1' bits in a 32 bit word (from Steve Baker's Cute Code Collection)
inline_ Type TClamp(const Type &x, const Type &lo, const Type &hi)
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:03