Browse Source

ARM64 stuff

Adam Ierymenko 5 years ago
parent
commit
483b47474d
1 changed files with 6 additions and 5 deletions
  1. 6 5
      node/Utils.hpp

+ 6 - 5
node/Utils.hpp

@@ -433,11 +433,11 @@ template<typename I>
 static ZT_INLINE I loadAsIsEndian(const void *const p) noexcept
 static ZT_INLINE I loadAsIsEndian(const void *const p) noexcept
 {
 {
 #ifdef ZT_NO_UNALIGNED_ACCESS
 #ifdef ZT_NO_UNALIGNED_ACCESS
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-	return _load_le_bysize<I,sizeof(I)>::l(reinterpret_cast<const uint8_t *>(p));
-#else
-	return _load_be_bysize<I,sizeof(I)>::l(reinterpret_cast<const uint8_t *>(p));
-#endif
+	I tmp;
+#pragma unroll
+	for(int i=0;i<(int)sizeof(I);++i)
+		reinterpret_cast<uint8_t *>(&tmp)[i] = reinterpret_cast<const uint8_t *>(p)[i];
+	return tmp;
 #else
 #else
 	return *reinterpret_cast<const I *>(p);
 	return *reinterpret_cast<const I *>(p);
 #endif
 #endif
@@ -454,6 +454,7 @@ template<typename I>
 static ZT_INLINE void storeAsIsEndian(void *const p,const I i) noexcept
 static ZT_INLINE void storeAsIsEndian(void *const p,const I i) noexcept
 {
 {
 #ifdef ZT_NO_UNALIGNED_ACCESS
 #ifdef ZT_NO_UNALIGNED_ACCESS
+#pragma unroll
 	for(unsigned int k=0;k<sizeof(I);++k)
 	for(unsigned int k=0;k<sizeof(I);++k)
 		reinterpret_cast<uint8_t *>(p)[k] = reinterpret_cast<const uint8_t *>(&i)[k];
 		reinterpret_cast<uint8_t *>(p)[k] = reinterpret_cast<const uint8_t *>(&i)[k];
 #else
 #else