Statistics
| Branch: | Tag: | Revision:

root / volk / include / volk / volk_common.h @ d825bb2b

History | View | Annotate | Download (2.9 kB)

1
#ifndef INCLUDED_LIBVOLK_COMMON_H
2
#define INCLUDED_LIBVOLK_COMMON_H
3
4
////////////////////////////////////////////////////////////////////////
5
// Cross-platform attribute macros
6
////////////////////////////////////////////////////////////////////////
7
#if defined __GNUC__
8
#  define __VOLK_ATTR_ALIGNED(x) __attribute__((aligned(x)))
9
#  define __VOLK_ATTR_UNUSED     __attribute__((unused))
10
#  define __VOLK_ATTR_INLINE     __attribute__((always_inline))
11
#  define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
12
#  if __GNUC__ >= 4
13
#    define __VOLK_ATTR_EXPORT   __attribute__((visibility("default")))
14
#    define __VOLK_ATTR_IMPORT   __attribute__((visibility("default")))
15
#  else
16
#    define __VOLK_ATTR_EXPORT
17
#    define __VOLK_ATTR_IMPORT
18
#  endif
19
#elif _MSC_VER
20
#  define __VOLK_ATTR_ALIGNED(x) __declspec(align(x))
21
#  define __VOLK_ATTR_UNUSED
22
#  define __VOLK_ATTR_INLINE     __forceinline
23
#  define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
24
#  define __VOLK_ATTR_EXPORT     __declspec(dllexport)
25
#  define __VOLK_ATTR_IMPORT     __declspec(dllimport)
26
#else
27
#  define __VOLK_ATTR_ALIGNED(x)
28
#  define __VOLK_ATTR_UNUSED
29
#  define __VOLK_ATTR_INLINE
30
#  define __VOLK_ATTR_DEPRECATED
31
#  define __VOLK_ATTR_EXPORT
32
#  define __VOLK_ATTR_IMPORT
33
#endif
34
35
////////////////////////////////////////////////////////////////////////
36
// Ignore annoying warnings in MSVC
37
////////////////////////////////////////////////////////////////////////
38
#if defined(_MSC_VER)
39
#  pragma warning(disable: 4244) //'conversion' conversion from 'type1' to 'type2', possible loss of data
40
#  pragma warning(disable: 4305) //'identifier' : truncation from 'type1' to 'type2'
41
#endif
42
43
////////////////////////////////////////////////////////////////////////
44
// C-linkage declaration macros
45
// FIXME: due to the usage of complex.h, require gcc for c-linkage
46
////////////////////////////////////////////////////////////////////////
47
#if defined(__cplusplus) && (__GNUC__)
48
#  define __VOLK_DECL_BEGIN extern "C" {
49
#  define __VOLK_DECL_END }
50
#else
51
#  define __VOLK_DECL_BEGIN
52
#  define __VOLK_DECL_END
53
#endif
54
55
////////////////////////////////////////////////////////////////////////
56
// Define VOLK_API for library symbols
57
// http://gcc.gnu.org/wiki/Visibility
58
////////////////////////////////////////////////////////////////////////
59
#ifdef volk_EXPORTS
60
#  define VOLK_API __VOLK_ATTR_EXPORT
61
#else
62
#  define VOLK_API __VOLK_ATTR_IMPORT
63
#endif
64
65
////////////////////////////////////////////////////////////////////////
66
// The bit128 union used by some
67
////////////////////////////////////////////////////////////////////////
68
#include <inttypes.h>
69
70
#ifdef LV_HAVE_SSE
71
#include <xmmintrin.h>
72
#endif
73
74
#ifdef LV_HAVE_SSE2
75
#include <emmintrin.h>
76
#endif
77
78
union bit128{
79
  uint16_t i16[8];
80
  uint32_t i[4];
81
  float f[4];
82
  double d[2];
83
84
  #ifdef LV_HAVE_SSE
85
  __m128 float_vec;
86
  #endif
87
88
  #ifdef LV_HAVE_SSE2
89
  __m128i int_vec;
90
  __m128d double_vec;
91
  #endif
92
};
93
94
#define bit128_p(x) ((union bit128 *)(x))
95
96
#endif /*INCLUDED_LIBVOLK_COMMON_H*/