endianness.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_CONFIG_ENDIANNESS_HPP_
13 #define ECL_CONFIG_ENDIANNESS_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include "portable_types.hpp"
20 
21 /*****************************************************************************
22 ** Namespaces
23 *****************************************************************************/
24 
25 namespace ecl {
38  inline bool is_big_endian() {
39  union {
40  uint32 i;
41  char c[4];
42  } bint = {0x01020304};
43 
44  return bint.c[0] == 1;
45  }
46 
47 } // namespace ecl
48 
49 #endif /* ECL_CONFIG_ENDIANNESS_HPP_ */
Type definitions for integer types.
bool is_big_endian()
Determines if your platform is big endian (at compile time).
Definition: endianness.hpp:38


ecl_config
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:16:09