[Lldb-commits] [lldb] r213861 - Fix endian test for big-endian hosts

Ed Maste emaste at freebsd.org
Thu Jul 24 06:28:16 PDT 2014


Author: emaste
Date: Thu Jul 24 08:28:16 2014
New Revision: 213861

URL: http://llvm.org/viewvc/llvm-project?rev=213861&view=rev
Log:
Fix endian test for big-endian hosts

The uint16_t cast truncated the magic value to 0x00000304, making the
first byte 0 (eByteOrderInvalid) on big endian hosts.

Reported by Justin Hibbits.

Modified:
    lldb/trunk/include/lldb/Host/Endian.h

Modified: lldb/trunk/include/lldb/Host/Endian.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Endian.h?rev=213861&r1=213860&r2=213861&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Endian.h (original)
+++ lldb/trunk/include/lldb/Host/Endian.h Thu Jul 24 08:28:16 2014
@@ -20,7 +20,7 @@ namespace endian {
     {
         uint32_t num;
         uint8_t  bytes[sizeof(uint32_t)];
-    } const endianTest = { (uint16_t)0x01020304 };
+    } const endianTest = { 0x01020304 };
     
     inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; }
 





More information about the lldb-commits mailing list