//===-- Endian.h ------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_host_endian_h_
#define liblldb_host_endian_h_

#include "lldb/lldb-enumerations.h"

namespace lldb {

namespace endian {

    static union EndianTest
    {
        uint32_t num;
        uint8_t  bytes[sizeof(uint32_t)];
    } const endianTest = { (uint16_t)0x01020304 };
    
    inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; }

//    ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
}

}

#endif  // liblldb_host_endian_h_


//===-- Endian.h ------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_host_endian_h_
#define liblldb_host_endian_h_

#include "lldb/lldb-enumerations.h"

namespace lldb {

namespace endian {

    static union EndianTest
    {
        uint32_t num;
        uint8_t  bytes[sizeof(uint32_t)];
    } const endianTest = { 0x01020304 };
    
    inline ByteOrder InlHostByteOrder() { return (ByteOrder)endianTest.bytes[0]; }

//    ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
}

}

#endif  // liblldb_host_endian_h_


Fix endian test for big-endian hosts
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.


git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@213861 91177308-0d34-0410-b5e6-96231b3b80d8
