Nu:Tekt NTS-1 digital SDK
v1.1-0
|
Go to the documentation of this file.
62 static inline __attribute__((optimize(
"Ofast"), always_inline))
64 return (((x)>=m)?m:(x));
69 static inline __attribute__((optimize(
"Ofast"), always_inline))
71 return (((x)<=m)?m:(x));
76 static inline __attribute__((optimize(
"Ofast"), always_inline))
77 int32_t
clipminmaxi32(const int32_t min, const int32_t x, const int32_t max) {
78 return (((x)>=max)?max:((x)<=min)?min:(x));
83 static inline __attribute__((optimize(
"Ofast"), always_inline))
84 uint32_t
clipmaxu32(const uint32_t x, const uint32_t m) {
85 return (((x)>=m)?m:(x));
90 static inline __attribute__((optimize(
"Ofast"), always_inline))
91 uint32_t
clipminu32(const uint32_t m, const uint32_t x) {
92 return (((x)<=m)?m:(x));
97 static inline __attribute__((optimize(
"Ofast"), always_inline))
98 uint32_t
clipminmaxu32(const uint32_t min, const uint32_t x, const uint32_t max) {
99 return (((x)>=max)?max:((x)<=min)?min:(x));
116 static inline __attribute__((always_inline))
119 x |= x>>1; x |= x>>2;
120 x |= x>>4; x |= x>>8;
127 static inline __attribute__((always_inline))
129 return x && !(x & (x-1));
134 #endif // __int_math_h
static uint32_t clipmaxu32(const uint32_t x, const uint32_t m)
Clip upper bound of unsigned integer x to m (inclusive)
static uint32_t clipminmaxu32(const uint32_t min, const uint32_t x, const uint32_t max)
Clip unsigned integer x between min and max (inclusive)
static uint32_t clipminu32(const uint32_t m, const uint32_t x)
Clip lower bound of unsigned integer x to m (inclusive)
static int32_t clipmaxi32(const int32_t x, const int32_t m)
Clip upper bound of signed integer x to m (inclusive)
static uint8_t ispow2_u32(const uint32_t x)
Check if x is a power of 2.
static int32_t clipmini32(const int32_t m, const int32_t x)
Clip lower bound of signed integer x to m (inclusive)
static int32_t clipminmaxi32(const int32_t min, const int32_t x, const int32_t max)
Clip signe integer x between min and max (inclusive)
static uint32_t nextpow2_u32(uint32_t x)
Compute next power of 2 greater than x.