Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
<complex>: Force aligning to the total size of both components in com…
Browse files Browse the repository at this point in the history
…plex<T>
  • Loading branch information
wmaxey committed Apr 27, 2021
1 parent 4b1a1df commit c7446b3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libcxx/include/complex
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ template<class T, class charT, class traits>
#pragma GCC system_header
#endif

# if _LIBCUDACXX_CUDA_ABI_VERSION > 3
# define _LIBCUDACXX_COMPLEX_ALIGNAS(V) alignas(64)
# else
# define _LIBCUDACXX_COMPLEX_ALIGNAS(V)
# endif

_LIBCUDACXX_BEGIN_NAMESPACE_STD

template<class _Tp> class _LIBCUDACXX_TEMPLATE_VIS complex;
Expand All @@ -264,7 +270,7 @@ template<class _Tp> _LIBCUDACXX_INLINE_VISIBILITY
complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);

template<class _Tp>
class _LIBCUDACXX_TEMPLATE_VIS complex
class _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(_Tp))_LIBCUDACXX_TEMPLATE_VIS complex
{
public:
typedef _Tp value_type;
Expand Down Expand Up @@ -328,7 +334,7 @@ template<> class complex<long double>;
#endif // _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE

template<>
class _LIBCUDACXX_TEMPLATE_VIS complex<float>
class _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(float))_LIBCUDACXX_TEMPLATE_VIS complex<float>
{
float __re_;
float __im_;
Expand Down Expand Up @@ -386,7 +392,7 @@ public:
};

template<>
class _LIBCUDACXX_TEMPLATE_VIS complex<double>
class _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(double))_LIBCUDACXX_TEMPLATE_VIS complex<double>
{
double __re_;
double __im_;
Expand Down Expand Up @@ -444,7 +450,7 @@ public:
};

template<>
class _LIBCUDACXX_TEMPLATE_VIS complex<long double>
class _LIBCUDACXX_COMPLEX_ALIGNAS(2*sizeof(long double))_LIBCUDACXX_TEMPLATE_VIS complex<long double>
{
#ifndef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE
public:
Expand Down

0 comments on commit c7446b3

Please sign in to comment.