HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
endian.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License.
3 
4 #pragma once
5 
6 namespace onnxruntime {
7 
8 // the semantics of this enum should match std::endian from C++20
9 enum class endian {
10 #if defined(_WIN32)
11  little = 0,
12  big = 1,
13  native = little,
14 #elif defined(__GNUC__) || defined(__clang__)
15  little = __ORDER_LITTLE_ENDIAN__,
16  big = __ORDER_BIG_ENDIAN__,
17  native = __BYTE_ORDER__,
18 #else
19 #error onnxruntime::endian is not implemented in this environment.
20 #endif
21 };
22 
23 static_assert(
25  "Only little-endian or big-endian native byte orders are supported.");
26 
27 } // namespace onnxruntime