6 #ifndef SIM_EXTENSION_HPP
7 #define SIM_EXTENSION_HPP
9 #include "itpp/itbase.h"
12 typedef std::complex<double> complexd;
27 typedef int16_t q15_t;
32 typedef int32_t q31_t;
37 typedef int64_t q63_t;
42 typedef float float32_t;
47 typedef double float64_t;
52 static inline q31_t clip_q63_to_q31(q63_t x)
54 return ((q31_t)(x >> 32) != ((q31_t)x >> 31)) ? ((0x7FFFFFFF ^ ((q31_t)(x >> 63)))) : (q31_t)x;
60 static inline q15_t clip_q63_to_q15(q63_t x)
62 return ((q31_t)(x >> 32) != ((q31_t)x >> 31)) ? ((0x7FFF ^ ((q15_t)(x >> 63)))) : (q15_t)(x >> 15);
68 static inline q7_t clip_q31_to_q7(q31_t x)
70 return ((q31_t)(x >> 24) != ((q31_t)x >> 23)) ? ((0x7F ^ ((q7_t)(x >> 31)))) : (q7_t)x;
76 static inline q15_t clip_q31_to_q15(q31_t x)
78 return ((q31_t)(x >> 16) != ((q31_t)x >> 15)) ? ((0x7FFF ^ ((q15_t)(x >> 31)))) : (q15_t)x;
84 static inline q63_t mult32x64(q63_t x, q31_t y)
86 return ((((q63_t)(x & 0x00000000FFFFFFFF) * y) >> 32) + (((q63_t)(x >> 32) * y)));
89 static inline q31_t __SSAT(q31_t x, uint32_t y)
91 int32_t posMax, negMin;
95 for(i = 0; i < (y - 1); i++)
102 posMax = (posMax - 1);