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 LLDB_UTILITY_ENDIAN_H 11 #define LLDB_UTILITY_ENDIAN_H 12 13 #include "lldb/lldb-enumerations.h" 14 15 #include <stdint.h> 16 17 namespace lldb_private { 18 19 namespace endian { 20 21 static union EndianTest { 22 uint32_t num; 23 uint8_t bytes[sizeof(uint32_t)]; 24 } const endianTest = {0x01020304}; 25 InlHostByteOrder()26inline lldb::ByteOrder InlHostByteOrder() { 27 return (lldb::ByteOrder)endianTest.bytes[0]; 28 } 29 30 // ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0]; 31 } 32 } 33 34 #endif // liblldb_host_endian_h_ 35