aboutsummaryrefslogtreecommitdiff
path: root/include/dspi/DSPI.h
blob: d9e2acf0530286949f51828896fe549b42bf1c83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef DSPI_h
#define DSPI_h

#define DSPImin(x,y)			(((x)<(y)) ? (x) : (y))
#define DSPImax(x,y)			(((x)>(y)) ? (x) : (y))
#define DSPIclip(min, x, max)	(DSPImin(DSPImax((min), (x)), max))


// test if floating point number is denormal
#define DSPI_IS_DENORMAL(f) (((*(unsigned int *)&(f))&0x7f800000) == 0) 

// test if almost denormal, choose whichever is fastest
#define DSPI_IS_ALMOST_DENORMAL(f) (((*(unsigned int *)&(f))&0x7f800000) < 0x08000000)
//#define DSPI_IS_ALMOST_DENORMAL(f) (fabs(f) < 3.e-34) 

#endif