1 //===-- Endian.h ------------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_host_endian_h_ 11 #define liblldb_host_endian_h_ 12 13 #include "lldb/lldb-enumerations.h" 14 15 namespace lldb { 16 17 namespace endian { 18 19 static union EndianTest 20 { 21 uint32_t num; 22 uint8_t bytes[sizeof(uint32_t)]; 23 } const endianTest = { (uint16_t)0x01020304 }; 24 InlHostByteOrder()25 inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; } 26 27 // ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0]; 28 } 29 30 } 31 32 #endif // liblldb_host_endian_h_ 33 34