LLDB  mainline
Endian.h
Go to the documentation of this file.
1 //===-- Endian.h ------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_UTILITY_ENDIAN_H
10 #define LLDB_UTILITY_ENDIAN_H
11 
12 #include "lldb/lldb-enumerations.h"
13 
14 #include <cstdint>
15 
16 namespace lldb_private {
17 
18 namespace endian {
19 
20 static union EndianTest {
22  uint8_t bytes[sizeof(uint32_t)];
23 } const endianTest = {0x01020304};
24 
26  return static_cast<lldb::ByteOrder>(endianTest.bytes[0]);
27 }
28 
29 // ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
30 }
31 }
32 
33 #endif // LLDB_UTILITY_ENDIAN_H
lldb_private::endian::EndianTest::num
uint32_t num
Definition: Endian.h:21
lldb-enumerations.h
lldb_private::endian::EndianTest
Definition: Endian.h:20
lldb_private::endian::endianTest
static union lldb_private::endian::EndianTest endianTest
uint32_t
lldb_private::endian::InlHostByteOrder
lldb::ByteOrder InlHostByteOrder()
Definition: Endian.h:25
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::endian::EndianTest::bytes
uint8_t bytes[sizeof(uint32_t)]
Definition: Endian.h:22
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138