1515#include < cstddef>
1616#include < limits>
1717#include < ostream>
18+ #include < cassert>
1819
1920#ifdef XSIMD_ENABLE_XTL_COMPLEX
2021#include " xtl/xcomplex.hpp"
@@ -199,9 +200,18 @@ namespace xsimd
199200 load_unaligned (const T* src);
200201
201202 template <class T >
202- void store_aligned (T* dst) const ;
203+ inline typename std::enable_if<detail::is_complex<T>::value, void >::type
204+ store_aligned (T* dst) const ;
203205 template <class T >
204- void store_unaligned (T* dst) const ;
206+ inline typename std::enable_if<detail::is_complex<T>::value, void >::type
207+ store_unaligned (T* dst) const ;
208+
209+ template <class T >
210+ inline typename std::enable_if<!detail::is_complex<T>::value, void >::type
211+ store_aligned (T* dst) const ;
212+ template <class T >
213+ inline typename std::enable_if<!detail::is_complex<T>::value, void >::type
214+ store_unaligned (T* dst) const ;
205215
206216 value_type operator [](std::size_t index) const ;
207217
@@ -824,12 +834,13 @@ namespace xsimd
824834 // / @endcond
825835
826836 /* *
827- * Stores the N values of the batch into a contiguous array
837+ * Stores the N values of the batch into a contiguous array of complex
828838 * pointed by \c dst. \c dst must be aligned.
829839 */
830840 template <class X >
831841 template <class T >
832- inline void simd_complex_batch<X>::store_aligned(T* dst) const
842+ inline typename std::enable_if<detail::is_complex<T>::value, void >::type
843+ simd_complex_batch<X>::store_aligned(T* dst) const
833844 {
834845 real_batch hi = (*this )().get_complex_high ();
835846 real_batch lo = (*this )().get_complex_low ();
@@ -840,12 +851,26 @@ namespace xsimd
840851 }
841852
842853 /* *
843- * Stores the N values of the batch into a contiguous array
854+ * Stores the N values of the batch into a contiguous array of reals
855+ * pointed by \c dst. \c dst must be aligned.
856+ */
857+ template <class X >
858+ template <class T >
859+ inline typename std::enable_if<!detail::is_complex<T>::value, void >::type
860+ simd_complex_batch<X>::store_aligned(T* dst) const
861+ {
862+ m_real.store_aligned (dst);
863+ assert (all (m_imag == 0 ) && " no imaginary part" );
864+ }
865+
866+ /* *
867+ * Stores the N values of the batch into a contiguous array of complex
844868 * pointed by \c dst. \c dst is not required to be aligned.
845869 */
846870 template <class X >
847871 template <class T >
848- inline void simd_complex_batch<X>::store_unaligned(T* dst) const
872+ inline typename std::enable_if<detail::is_complex<T>::value, void >::type
873+ simd_complex_batch<X>::store_unaligned(T* dst) const
849874 {
850875 real_batch hi = (*this )().get_complex_high ();
851876 real_batch lo = (*this )().get_complex_low ();
@@ -854,6 +879,20 @@ namespace xsimd
854879 hi.store_unaligned (rbuf);
855880 lo.store_unaligned (rbuf + size);
856881 }
882+
883+ /* *
884+ * Stores the N values of the batch into a contiguous array of reals
885+ * pointed by \c dst. \c dst is not required to be aligned.
886+ */
887+ template <class X >
888+ template <class T >
889+ inline typename std::enable_if<!detail::is_complex<T>::value, void >::type
890+ simd_complex_batch<X>::store_unaligned(T* dst) const
891+ {
892+ m_real.store_aligned (dst);
893+ assert (all (m_imag == 0 ) && " no imaginary part" );
894+ }
895+
857896 // @}
858897
859898 template <class X >
0 commit comments