-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathendian.h
More file actions
38 lines (31 loc) · 1.14 KB
/
endian.h
File metadata and controls
38 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//-------------------------------- endian.h ------------------------------------
//
// This software is in the public domain. The only restriction on its use is
// that no one can remove it from the public domain by claiming ownership of it,
// including the original authors.
//
// There is no warranty of correctness on the software contained herein. Use
// at your own risk.
//
//------------------------------------------------------------------------------
#ifndef ENDIAN_H
#define ENDIAN_H
namespace xstd
{
// endian provides answers to the following questions:
// 1. Is this system big or little endian?
// 2. Is the "desired endian" of some class or function the same as the
// native endian?
enum class endian
{
native = __BYTE_ORDER__,
little = __ORDER_LITTLE_ENDIAN__,
big = __ORDER_BIG_ENDIAN__
};
static_assert(endian::native == endian::little ||
endian::native == endian::big,
"endian::native shall be one of endian::little or endian::big");
static_assert(endian::big != endian::little,
"endian::big and endian::little shall have different values");
} // xstd
#endif // ENDIAN_H