macros.h
changeset 2952 6a26eeda9679
parent 2775 d3ed38a97250
child 2966 7f382cfeb93d
equal deleted inserted replaced
2951:2db3adee7736 2952:6a26eeda9679
   118 #define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * a) / b))
   118 #define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * a) / b))
   119 #define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * a) / b))
   119 #define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * a) / b))
   120 #define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * a) / b))
   120 #define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * a) / b))
   121 
   121 
   122 
   122 
   123 #define for_each_bit(_i,_b)										\
   123 #define for_each_bit(_i, _b)            \
   124 	for(_i=0; _b!=0; _i++,_b>>=1)								\
   124 	for (_i = 0; _b != 0; _i++, _b >>= 1) \
   125 		if (_b&1)
   125 		if (_b & 1)
   126 
   126 
   127 #define abs myabs
   127 #define abs myabs
   128 
   128 
   129 
   129 
   130 static inline int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }
   130 static inline int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }