Skip to content

Commit

Permalink
Trying to fix -Wundefined-var-template
Browse files Browse the repository at this point in the history
This is needed for clang to stop complaining. OTOH, MSVC doesn't like
clangs suggested solution and barfs on the code. So #ifdef it.

Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Jan 17, 2017
1 parent 83d7932 commit 2284539
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions avx/const_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,27 @@ template<typename T> struct c_trig
{
alignas(64) static const T data[];
};
#ifndef Vc_MSVC
template <> alignas(64) const float c_trig<float>::data[];
template <> alignas(64) const double c_trig<double>::data[];
#endif

template<typename T> struct c_log
{
typedef float floatAlias Vc_MAY_ALIAS;
static Vc_ALWAYS_INLINE float d(int i) { return *reinterpret_cast<const floatAlias *>(&data[i]); }
alignas(64) static const unsigned int data[];
alignas(64) static const unsigned int data[21];
};
#ifndef Vc_MSVC
template<> alignas(64) const unsigned int c_log<float>::data[21];
#endif

template<> struct c_log<double>
{
enum VectorSize { Size = 16 / sizeof(double) };
typedef double doubleAlias Vc_MAY_ALIAS;
static Vc_ALWAYS_INLINE double d(int i) { return *reinterpret_cast<const doubleAlias *>(&data[i]); }
alignas(64) static const unsigned long long data[];
alignas(64) static const unsigned long long data[21];
};

} // namespace AVX
Expand Down
11 changes: 9 additions & 2 deletions sse/const_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,26 @@ template<typename T> struct c_trig
{
alignas(64) static const T data[];
};
#ifndef Vc_MSVC
template <> alignas(64) const float c_trig<float>::data[];
template <> alignas(64) const double c_trig<double>::data[];
#endif

template<typename T> struct c_log
{
enum VectorSize { Size = 16 / sizeof(T) };
static Vc_ALWAYS_INLINE Vc_CONST const float *d(int i) { return reinterpret_cast<const float *>(&data[i * Size]); }
alignas(64) static const unsigned int data[];
alignas(64) static const unsigned int data[21 * Size];
};
#ifndef Vc_MSVC
template<> alignas(64) const unsigned int c_log<float>::data[21 * 4];
#endif

template<> struct c_log<double>
{
enum VectorSize { Size = 16 / sizeof(double) };
static Vc_ALWAYS_INLINE Vc_CONST const double *d(int i) { return reinterpret_cast<const double *>(&data[i * Size]); }
alignas(64) static const unsigned long long data[];
alignas(64) static const unsigned long long data[21 * Size];
};

} // namespace SSE
Expand Down

0 comments on commit 2284539

Please sign in to comment.