[Lldb-commits] [lldb] r105746 - /lldb/trunk/include/lldb/lldb-enumerations.h

Eli Friedman eli.friedman at gmail.com
Wed Jun 9 12:26:51 PDT 2010


Author: efriedma
Date: Wed Jun  9 14:26:51 2010
New Revision: 105746

URL: http://llvm.org/viewvc/llvm-project?rev=105746&view=rev
Log:
Use portable endianness routine from LLVM.


Modified:
    lldb/trunk/include/lldb/lldb-enumerations.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=105746&r1=105745&r2=105746&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Wed Jun  9 14:26:51 2010
@@ -10,6 +10,8 @@
 #ifndef LLDB_enumerations_h_
 #define LLDB_enumerations_h_
 
+#include "llvm/System/Host.h"
+
 namespace lldb {
 
 //----------------------------------------------------------------------
@@ -71,18 +73,18 @@
     eByteOrderInvalid   = 0,
     eByteOrderLittle    = 1234,
     eByteOrderBig       = 4321,
-    eByteOrderPDP       = 3412,
-#if   defined (__LITTLE_ENDIAN__)
-    eByteOrderHost      = eByteOrderLittle
-#elif defined (__BIG_ENDIAN__)
-    eByteOrderHost      = eByteOrderBig
-#elif defined (__PDP_ENDIAN__)
-    eByteOrderHost      = eByteOrderPDP
-#else
-#error unable to detect endianness
-#endif
+    eByteOrderPDP       = 3412
 } ByteOrder;
 
+inline ByteOrder getHostByteOrder() {
+  if (llvm::sys::isLittleEndianHost())
+    return eByteOrderLittle;
+  return eByteOrderBig;
+}
+
+// FIXME: Replace uses of eByteOrderHost with getHostByteOrder()!
+const ByteOrder eByteOrderHost = getHostByteOrder();
+
 //----------------------------------------------------------------------
 // Register encoding definitions
 //----------------------------------------------------------------------





More information about the lldb-commits mailing list