36 return x != 0 && (x & (x-1)) == 0;
65 float x1 = fabsf(x+clip);
66 float x2 = fabsf(x-clip);
71 static inline float gr_clip(
float x,
float clip)
93 if((r >= 0) && (i >= 0))
95 else if((r < 0) && (i >= 0))
97 else if((r < 0) && (i < 0))
106 unsigned int ret = 0;
107 if(fabsf(r) > fabsf(i)) {
141 unsigned int ret = 0;
142 ret = (fabsf(r) > fabsf(i)) * (((r < 0) << 0x1));
143 ret |= (fabsf(i) > fabsf(r)) * (((i < 0) << 0x1) | 0x1);
156 ret |= ((i <= 0) << 1);
157 return (ret ^ ((ret & 0x2) >> 0x1));
195 return x & (pow2 - 1);
static size_t gr_p2_modulo(size_t x, size_t pow2)
Definition: gr_math.h:193
GR_CORE_API float gr_fast_atan2f(float y, float x)
Fast arc tangent using table lookup and linear interpolation.
static unsigned int gr_binary_slicer(float x)
Definition: gr_math.h:82
static size_t gr_p2_modulo_neg(size_t x, size_t pow2)
Definition: gr_math.h:204
static unsigned int gr_branchless_quad_45deg_slicer(float r, float i)
Definition: gr_math.h:153
static float gr_branchless_clip(float x, float clip)
Definition: gr_math.h:63
static bool gr_is_power_of_2(long x)
Definition: gr_math.h:34
static size_t gr_p2_round_down(size_t x, size_t pow2)
Definition: gr_math.h:171
static unsigned int gr_quad_0deg_slicer(float r, float i)
Definition: gr_math.h:104
#define GR_CORE_API
Definition: gr_core_api.h:30
std::complex< float > gr_complex
Definition: gr_complex.h:26
static size_t gr_p2_round_up(size_t x, size_t pow2)
Definition: gr_math.h:182
static unsigned int gr_branchless_quad_0deg_slicer(float r, float i)
Definition: gr_math.h:139
static float gr_clip(float x, float clip)
Definition: gr_math.h:71
static unsigned int gr_branchless_binary_slicer(float x)
Definition: gr_math.h:134
static unsigned int gr_quad_45deg_slicer(float r, float i)
Definition: gr_math.h:90