Fix build error on big endian architectures

This commit is contained in:
Gioacchino Mazzurco 2020-08-01 18:23:35 +02:00
parent 9587cfd4d9
commit 3a6648f706
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051

View file

@ -26,7 +26,7 @@
* This file provide convenient integer endiannes conversion utilities. * This file provide convenient integer endiannes conversion utilities.
* Instead of providing them with different names for each type (a la C htonl, * Instead of providing them with different names for each type (a la C htonl,
* htons, ntohl, ntohs ), which make them uncomfortable to use, expose a * htons, ntohl, ntohs ), which make them uncomfortable to use, expose a
* templated function `rs_endian_fix` to reorder integers representation byets * templated function `rs_endian_fix` to reorder integers bytes representation
* when sending or receiving from the network. */ * when sending or receiving from the network. */
/* enforce LITTLE_ENDIAN on Windows */ /* enforce LITTLE_ENDIAN on Windows */
@ -46,7 +46,7 @@ template<typename INTTYPE> inline INTTYPE rs_endian_fix(INTTYPE val)
swapped |= (val >> (8*(sizeof(INTTYPE)-i-1)) & 0xFF) << (8*i); swapped |= (val >> (8*(sizeof(INTTYPE)-i-1)) & 0xFF) << (8*i);
return swapped; return swapped;
#else #else
return hostI; return val;
#endif #endif
}; };