GNU Radio 3.6.5 C++ API

volk_common.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_LIBVOLK_COMMON_H
00002 #define INCLUDED_LIBVOLK_COMMON_H
00003 
00004 ////////////////////////////////////////////////////////////////////////
00005 // Cross-platform attribute macros
00006 ////////////////////////////////////////////////////////////////////////
00007 #if defined __GNUC__
00008 #  define __VOLK_ATTR_ALIGNED(x) __attribute__((aligned(x)))
00009 #  define __VOLK_ATTR_UNUSED     __attribute__((unused))
00010 #  define __VOLK_ATTR_INLINE     __attribute__((always_inline))
00011 #  define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
00012 #  if __GNUC__ >= 4
00013 #    define __VOLK_ATTR_EXPORT   __attribute__((visibility("default")))
00014 #    define __VOLK_ATTR_IMPORT   __attribute__((visibility("default")))
00015 #  else
00016 #    define __VOLK_ATTR_EXPORT
00017 #    define __VOLK_ATTR_IMPORT
00018 #  endif
00019 #elif _MSC_VER
00020 #  define __VOLK_ATTR_ALIGNED(x) __declspec(align(x))
00021 #  define __VOLK_ATTR_UNUSED
00022 #  define __VOLK_ATTR_INLINE     __forceinline
00023 #  define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
00024 #  define __VOLK_ATTR_EXPORT     __declspec(dllexport)
00025 #  define __VOLK_ATTR_IMPORT     __declspec(dllimport)
00026 #else
00027 #  define __VOLK_ATTR_ALIGNED(x)
00028 #  define __VOLK_ATTR_UNUSED
00029 #  define __VOLK_ATTR_INLINE
00030 #  define __VOLK_ATTR_DEPRECATED
00031 #  define __VOLK_ATTR_EXPORT
00032 #  define __VOLK_ATTR_IMPORT
00033 #endif
00034 
00035 ////////////////////////////////////////////////////////////////////////
00036 // Ignore annoying warnings in MSVC
00037 ////////////////////////////////////////////////////////////////////////
00038 #if defined(_MSC_VER)
00039 #  pragma warning(disable: 4244) //'conversion' conversion from 'type1' to 'type2', possible loss of data
00040 #  pragma warning(disable: 4305) //'identifier' : truncation from 'type1' to 'type2'
00041 #endif
00042 
00043 ////////////////////////////////////////////////////////////////////////
00044 // C-linkage declaration macros
00045 // FIXME: due to the usage of complex.h, require gcc for c-linkage
00046 ////////////////////////////////////////////////////////////////////////
00047 #if defined(__cplusplus) && (__GNUC__)
00048 #  define __VOLK_DECL_BEGIN extern "C" {
00049 #  define __VOLK_DECL_END }
00050 #else
00051 #  define __VOLK_DECL_BEGIN
00052 #  define __VOLK_DECL_END
00053 #endif
00054 
00055 ////////////////////////////////////////////////////////////////////////
00056 // Define VOLK_API for library symbols
00057 // http://gcc.gnu.org/wiki/Visibility
00058 ////////////////////////////////////////////////////////////////////////
00059 #ifdef volk_EXPORTS
00060 #  define VOLK_API __VOLK_ATTR_EXPORT
00061 #else
00062 #  define VOLK_API __VOLK_ATTR_IMPORT
00063 #endif
00064 
00065 ////////////////////////////////////////////////////////////////////////
00066 // The bit128 union used by some
00067 ////////////////////////////////////////////////////////////////////////
00068 #include <inttypes.h>
00069 
00070 #ifdef LV_HAVE_SSE
00071 #include <xmmintrin.h>
00072 #endif
00073 
00074 #ifdef LV_HAVE_SSE2
00075 #include <emmintrin.h>
00076 #endif
00077 
00078 union bit128{
00079   uint16_t i16[8];
00080   uint32_t i[4];
00081   float f[4];
00082   double d[2];
00083 
00084   #ifdef LV_HAVE_SSE
00085   __m128 float_vec;
00086   #endif
00087 
00088   #ifdef LV_HAVE_SSE2
00089   __m128i int_vec;
00090   __m128d double_vec;
00091   #endif
00092 };
00093 
00094 #define bit128_p(x) ((union bit128 *)(x))
00095 
00096 #endif /*INCLUDED_LIBVOLK_COMMON_H*/