#include "customize.h"

MainFloat fTMp;  MainInt iTMp;
#define     PI 3.14159265358979323846
#define  TWOPI 6.28318530717958647692
#define HALFPI 1.57079632679489661923
#define SQRT(x) sqrt((MainFloat) (x))
#define HYPOT(x,y) hypot((MainFloat) (x),(MainFloat) (y))
#define SIN(x) sin((MainFloat) (x))
#define COS(x) cos((MainFloat) (x))
#define TAN(x) tan((MainFloat) (x))
#define ASIN(x) asin((MainFloat) (x))
#define ACOS(x) acos((MainFloat) (x))
#define ATAN(x) atan((MainFloat) (x))
#define ATAN2(x,y) atan2((MainFloat) (x), (MainFloat) (y))
#define LOG(x) log((MainFloat) (x))
#define LOG10(x) log10((MainFloat) (x))
#define EXP(x) exp((MainFloat) (x))
#define POW(x,y) pow((MainFloat) (x), (MainFloat) (y))
#define SINH(x) sinh((MainFloat) (x))
#define COSH(x) cosh((MainFloat) (x))
#define TANH(x) tanh((MainFloat) (x))
#define ABS(x)   (((x)<0) ? (-(x)) : (x))
#define SIGN(x)  (((x)<0) ? -1 : 1)
#define MIN(x,y) (( (x) > (y) ) ? (y) : (x) )
#define MAX(x,y) (( (x) > (y) ) ? (x) : (y) )
#define SHIFT(a,s) (( (iTMp=s) >= 0 ) ? ((a) << iTMp) : ((a) >> (-iTMp)) )
#define SWAP(a,b) (a -= (b = (a += b) - b))
#define SWAPi(a,b) (iTMp=a,a=b,b=iTMp)
#define SWAPf(a,b) (fTMp=a,a=b,b=fTMp)
#define   FLOOR(x) 	floor((MainFloat) (x))
#define   CEIL(x) 	ceil((MainFloat) (x))
#define   ROUND(x) 	floor(((MainFloat) (x)) + 0.5)

/* Masks for bitwise manipulations, counting, flipping, etc - 32 bit version*/
#define BM1 0x55555555
#define BM2 0x33333333
#define BM4 0x0f0f0f0f
#define BM8 0x00ff00ff
#define BMx 0x0000ffff 

#define ISQRTSZ (1<<8)  /* 1<<8 maximum, if ISQRT[] is unsigned char */
#define ISQRTSZ2 (ISQRTSZ*ISQRTSZ)
#define ISQSZ (1<<16)    /* up to 1<<16, if ISQ unsigned */


#ifndef is_cmacs      /* Routines and data defined in cmacs.c */
extern unsigned MainInt *ISQ;	/* integer square table, i^2, i < ISQSIZ */
extern unsigned char *ISQRT;	/* integer sqrt(i), i < ISQRTSZ^2 */
extern InitCmacs();
#endif /* not is_cmacs */
