Skip to content

Commit 5b9a9f2

Browse files
WIP
1 parent 0fa582d commit 5b9a9f2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/xsimd/arch/xsimd_altivec.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#include <limits>
1717
#include <type_traits>
1818

19+
#ifdef __linux__
20+
#include <endian.h>
21+
#endif
22+
1923
#include "../types/xsimd_altivec_register.hpp"
2024

2125
namespace xsimd
@@ -918,14 +922,22 @@ namespace xsimd
918922
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
919923
XSIMD_INLINE void store_aligned(T* mem, batch<T, A> const& self, requires_arch<altivec>) noexcept
920924
{
925+
#if BYTE_ORDER == LITTLE_ENDIAN
921926
return vec_st(self.data, 0, reinterpret_cast<typename batch<T, A>::register_type*>(mem));
927+
#else
928+
return vec_st_be(self.data, 0, reinterpret_cast<typename batch<T, A>::register_type*>(mem));
929+
#endif
922930
}
923931

924932
// store_unaligned
925933
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
926934
XSIMD_INLINE void store_unaligned(T* mem, batch<T, A> const& self, requires_arch<altivec>) noexcept
927935
{
936+
#if BYTE_ORDER == LITTLE_ENDIAN
928937
return vec_xst(self.data, 0, reinterpret_cast<typename batch<T, A>::register_type*>(mem));
938+
#else
939+
return vec_xst_be(self.data, 0, reinterpret_cast<typename batch<T, A>::register_type*>(mem));
940+
#endif
929941
}
930942

931943
// sub

0 commit comments

Comments
 (0)