11#ifndef INCLUDED_LIBVOLK_COMMON_H
12#define INCLUDED_LIBVOLK_COMMON_H
18#define __VOLK_ATTR_ALIGNED(x) __declspec(align(x))
19#define __VOLK_ATTR_UNUSED
20#define __VOLK_ATTR_INLINE __forceinline
21#define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
22#define __VOLK_ATTR_EXPORT __declspec(dllexport)
23#define __VOLK_ATTR_IMPORT __declspec(dllimport)
24#define __VOLK_PREFETCH(addr)
25#define __VOLK_ASM __asm
26#elif defined(__clang__)
30#define __VOLK_ATTR_ALIGNED(x) __attribute__((aligned(x)))
31#define __VOLK_ATTR_UNUSED __attribute__((unused))
32#define __VOLK_ATTR_INLINE __attribute__((always_inline))
33#define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
34#define __VOLK_ASM __asm__
35#define __VOLK_ATTR_EXPORT __attribute__((visibility("default")))
36#define __VOLK_ATTR_IMPORT __attribute__((visibility("default")))
37#define __VOLK_PREFETCH(addr) __builtin_prefetch(addr)
39#define __VOLK_ATTR_ALIGNED(x) __attribute__((aligned(x)))
40#define __VOLK_ATTR_UNUSED __attribute__((unused))
41#define __VOLK_ATTR_INLINE __attribute__((always_inline))
42#define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
43#define __VOLK_ASM __asm__
45#define __VOLK_ATTR_EXPORT __attribute__((visibility("default")))
46#define __VOLK_ATTR_IMPORT __attribute__((visibility("default")))
48#define __VOLK_ATTR_EXPORT
49#define __VOLK_ATTR_IMPORT
51#define __VOLK_PREFETCH(addr) __builtin_prefetch(addr)
53#define __VOLK_ATTR_ALIGNED(x) __declspec(align(x))
54#define __VOLK_ATTR_UNUSED
55#define __VOLK_ATTR_INLINE __forceinline
56#define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
57#define __VOLK_ATTR_EXPORT __declspec(dllexport)
58#define __VOLK_ATTR_IMPORT __declspec(dllimport)
59#define __VOLK_PREFETCH(addr)
60#define __VOLK_ASM __asm
62#define __VOLK_ATTR_ALIGNED(x)
63#define __VOLK_ATTR_UNUSED
64#define __VOLK_ATTR_INLINE
65#define __VOLK_ATTR_DEPRECATED
66#define __VOLK_ATTR_EXPORT
67#define __VOLK_ATTR_IMPORT
68#define __VOLK_PREFETCH(addr)
69#define __VOLK_ASM __asm__
76#pragma warning(disable : 4244)
78#pragma warning(disable : 4305)
85#if defined(__cplusplus) && (__GNUC__)
86#define __VOLK_DECL_BEGIN extern "C" {
87#define __VOLK_DECL_END }
89#define __VOLK_DECL_BEGIN
90#define __VOLK_DECL_END
98#define VOLK_API __VOLK_ATTR_EXPORT
100#define VOLK_API __VOLK_ATTR_IMPORT
112#include <x86intrin.h>
147#define bit128_p(x) ((union bit128*)(x))
148#define bit256_p(x) ((union bit256*)(x))
157 float const result = log2f(f);
158 return isinf(result) ? copysignf(127.0f, result) : result;
165#define volk_log2to10factor (0x1.815182p1)
176 const float a1 = +0x1.ffffeap-1f;
177 const float a3 = -0x1.55437p-2f;
178 const float a5 = +0x1.972be6p-3f;
179 const float a7 = -0x1.1436ap-3f;
180 const float a9 = +0x1.5785aap-4f;
181 const float a11 = -0x1.2f3004p-5f;
182 const float a13 = +0x1.01a37cp-7f;
184 const float x_times_x = x * x;
186 arctan = fmaf(x_times_x, arctan, a11);
187 arctan = fmaf(x_times_x, arctan, a9);
188 arctan = fmaf(x_times_x, arctan, a7);
189 arctan = fmaf(x_times_x, arctan, a5);
190 arctan = fmaf(x_times_x, arctan, a3);
191 arctan = fmaf(x_times_x, arctan, a1);
204 const float pi_2 = 0x1.921fb6p0f;
226 const float pi = 0x1.921fb6p1f;
227 const float pi_2 = 0x1.921fb6p0f;
229 if (fabs(x) == 0.f) {
230 return (fabs(y) == 0.f) ? copysignf(0.f, y) : copysignf(pi_2, y);
232 const int swap = fabs(x) < fabs(y);
233 const float input = swap ? (x / y) : (y / x);
235 result = swap ? (input >= 0.f ? pi_2 : -pi_2) - result : result;
237 result += copysignf(pi, y);
Definition volk_common.h:116
float f[4]
Definition volk_common.h:120
__m128i int_vec
Definition volk_common.h:128
__m128d double_vec
Definition volk_common.h:129
uint8_t i8[16]
Definition volk_common.h:117
uint32_t i[4]
Definition volk_common.h:119
double d[2]
Definition volk_common.h:121
uint16_t i16[8]
Definition volk_common.h:118
__m128 float_vec
Definition volk_common.h:124
Definition volk_common.h:133
float f[8]
Definition volk_common.h:137
__m256d double_vec
Definition volk_common.h:143
uint8_t i8[32]
Definition volk_common.h:134
uint16_t i16[16]
Definition volk_common.h:135
double d[4]
Definition volk_common.h:138
uint32_t i[8]
Definition volk_common.h:136
__m256 float_vec
Definition volk_common.h:141
__m256i int_vec
Definition volk_common.h:142
static float volk_arctan(const float x)
Definition volk_common.h:199
static float volk_arctan_poly(const float x)
Definition volk_common.h:170
static float log2f_non_ieee(float f)
Definition volk_common.h:155
static float volk_atan2(const float y, const float x)
Definition volk_common.h:215