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);
143 return (x & ~(x >> 1));
162 OPASSERT(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)
217 #define IS_ALIGNED_2(x) ((x&1)==0)
218 #define IS_ALIGNED_4(x) ((x&3)==0)
219 #define IS_ALIGNED_8(x) ((x&7)==0)
254 #endif // __ICEUTILS_H__