sim-se: Add default to SyscallDesc constructor
[gem5.git] / src / sim / byteswap.hh
index 3a0f7ce8ae440c00b55c4691fc3d6f945431e8b2..23786bb713428a9804178bf20c11c32b827957fd 100644 (file)
 #define __SIM_BYTE_SWAP_HH__
 
 #include "base/bigint.hh"
-#include "base/misc.hh"
 #include "base/types.hh"
 
 // This lets us figure out what the byte order of the host system is
-#if defined(linux)
+#if defined(__linux__)
 #include <endian.h>
 // If this is a linux system, lets used the optimized definitions if they exist.
 // If one doesn't exist, we pretty much get what is listed below, so it all
 #include <libkern/OSByteOrder.h>
 #endif
 
-enum ByteOrder {BigEndianByteOrder, LittleEndianByteOrder};
-
 //These functions actually perform the swapping for parameters
 //of various bit lengths
 inline uint64_t
 swap_byte64(uint64_t x)
 {
-#if defined(linux)
+#if defined(__linux__)
     return bswap_64(x);
 #elif defined(__APPLE__)
     return OSSwapInt64(x);
@@ -84,7 +81,7 @@ swap_byte64(uint64_t x)
 inline uint32_t
 swap_byte32(uint32_t x)
 {
-#if defined(linux)
+#if defined(__linux__)
     return bswap_32(x);
 #elif defined(__APPLE__)
     return OSSwapInt32(x);
@@ -98,7 +95,7 @@ swap_byte32(uint32_t x)
 inline uint16_t
 swap_byte16(uint16_t x)
 {
-#if defined(linux)
+#if defined(__linux__)
     return bswap_16(x);
 #elif defined(__APPLE__)
     return OSSwapInt16(x);
@@ -149,7 +146,7 @@ template <typename T> inline T letobe(T value) {return swap_byte(value);}
 
 //For conversions not involving the guest system, we can define the functions
 //conditionally based on the BYTE_ORDER macro and outside of the namespaces
-#if defined(_BIG_ENDIAN) || !defined(_LITTLE_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+#if (defined(_BIG_ENDIAN) || !defined(_LITTLE_ENDIAN)) && BYTE_ORDER == BIG_ENDIAN
 const ByteOrder HostByteOrder = BigEndianByteOrder;
 template <typename T> inline T htole(T value) {return swap_byte(value);}
 template <typename T> inline T letoh(T value) {return swap_byte(value);}