rippled
endian.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of Beast: https://github.com/vinniefalco/Beast
4  Copyright 2014, Howard Hinnant <howard.hinnant@gmail.com>,
5  Vinnie Falco <vinnie.falco@gmail.com
6 
7  Permission to use, copy, modify, and/or distribute this software for any
8  purpose with or without fee is hereby granted, provided that the above
9  copyright notice and this permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19 //==============================================================================
20 
21 #ifndef BEAST_HASH_ENDIAN_H_INCLUDED
22 #define BEAST_HASH_ENDIAN_H_INCLUDED
23 
24 namespace beast {
25 
26 // endian provides answers to the following questions:
27 // 1. Is this system big or little endian?
28 // 2. Is the "desired endian" of some class or function the same as the
29 // native endian?
30 enum class endian {
31 #ifdef _MSC_VER
32  big = 1,
33  little = 0,
34  native = little
35 #else
36  native = __BYTE_ORDER__,
37  little = __ORDER_LITTLE_ENDIAN__,
38  big = __ORDER_BIG_ENDIAN__
39 #endif
40 };
41 
42 #ifndef __INTELLISENSE__
43 static_assert(
45  "endian::native shall be one of endian::little or endian::big");
46 
47 static_assert(
49  "endian::big and endian::little shall have different values");
50 #endif
51 
52 } // namespace beast
53 
54 #endif
beast::endian::little
@ little
beast::endian::big
@ big
beast::endian::native
@ native
beast::endian
endian
Definition: endian.h:30
beast
Definition: base_uint.h:646