/* misc */ #ifndef _MACRO_H_ #define _MACRO_H_ #include #include #ifdef TRUE #undef TRUE #endif #define TRUE (1) #ifdef FALSE #undef FALSE #endif #define FALSE (0) #ifdef MAX #undef MAX #endif #ifdef MIN #undef MIN #endif #define MAX(x,y) ( ((x) > (y)) ? (x) : (y) ) #define MIN(x,y) ( ((x) < (y)) ? (x) : (y) ) #ifdef BOUND #undef BOUND #endif #define BOUND(x,l,u) ( ((x) > (u)) ? (u) : \ ( ((x) < (l)) ? (l) : (x)) ) /* INT returns the round-up value of a float */ #ifdef INT #undef INT #endif #define INT(x) ((x)>0 ? (int)((x) + 0.5) : \ (int)((x) - 0.5) ) /* FLOOR returns the floor */ #ifdef FLOOR #undef FLOOR #endif #define FLOOR(x) ((int)floor((double)x)) /*CEILING returns the ceiling */ #ifdef CEILING #undef CEILING #endif #define CEILING(x) ((int)ceil((double)x)) #ifdef ABS #undef ABS #endif #define ABS(x) ( (x) > 0 ? (x) : (-(x)) ) #ifdef SQR #undef SOR #endif #define SQR(x) ((x)*(x)) #ifdef BOOLEAN #undef BOOLEAN #endif typedef unsigned char BOOLEAN; #endif