]> git.mxchange.org Git - flightgear.git/commitdiff
Better cross platform compatibility.
authorehofman <ehofman>
Wed, 21 Sep 2005 09:43:32 +0000 (09:43 +0000)
committerehofman <ehofman>
Wed, 21 Sep 2005 09:43:32 +0000 (09:43 +0000)
src/MultiPlayer/tiny_xdr.hpp

index 5d4d97de43ffc9e696a22f048f7ba7f90634497c..4db48604b6d762410d6a38f4e44957648aaf746e 100644 (file)
@@ -56,14 +56,16 @@ inline uint32_t bswap_32(unsigned int b) {
     return x;
 }
 
-inline uint64_t bswap_64(unsigned long long b) {
-#if __WORDSIZE == 64
+#if (SIZEOF_LONG_INT == 8)
+inline uint64_t bswap_64(unsigned long int b) {
     uint64_t x = b;
     x = ((x >>  8) & 0x00FF00FF00FF00FFLL) | ((x <<  8) & 0xFF00FF00FF00FF00LL);
     x = ((x >> 16) & 0x0000FFFF0000FFFFLL) | ((x << 16) & 0xFFFF0000FFFF0000LL);
     x = (x >> 32) | (x << 32);
     return x;
+}
 #else
+inline uint64_t bswap_64(unsigned long long int b) {
     union { 
          uint64_t ll;
          uint32_t l[2]; 
@@ -72,8 +74,8 @@ inline uint64_t bswap_64(unsigned long long b) {
      r.l[0] = bswap_32 (w.l[1]);
      r.l[1] = bswap_32 (w.l[0]);
      return r.ll;
-#endif
 }
+#endif
 
 #if BYTE_ORDER == BIG_ENDIAN
 #   define SWAP32(arg) arg