Skip to content

Commit 73b3b73

Browse files
WIP
1 parent 0fa582d commit 73b3b73

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
@@ -518,7 +522,11 @@ namespace xsimd
518522
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
519523
XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<altivec>) noexcept
520524
{
525+
#if BYTE_ORDER == LITTLE_ENDIAN
521526
return vec_xl(0, (typename batch<T, A>::register_type const*)mem);
527+
#else
528+
return vec_xl_be(0, (typename batch<T, A>::register_type const*)mem);
529+
#endif
522530
}
523531

524532
// load_complex
@@ -925,7 +933,11 @@ namespace xsimd
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)