StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHyperUtilPlatform.h
1 // StHyperUtilPlatform.h
2 #ifndef __ST_HYPERUTILPLATFORM_H
3 #define __ST_HYPERUTILPLATFORM_H
4 
5 #include <string>
6 
7 namespace StHyperUtilPlatform
8 {
9 
10 // very simple define copied from coreutils
11 #define st_hyper_util_platform_alignof(type) offsetof (struct { char c; type x; }, x)
12 
13 // another way to do that via pointer arithmetics
14 template <typename T> struct StHyperUtilPlatformAlignTest {
15  char m0;
16  T m1;
17 };
18 #define st_hyper_util_platform_alignof_p(TYPE) (size_t)&(((StHyperUtilPlatformAlignTest<TYPE>*)0)->m1)
19 
20 // Endian-ness test: little,big, or unknown?
21 // ABCD : Litte Endian - less significant byte first
22 // DCBA : Big Endian - most significant byte first
23 namespace Endian
24 {
25  enum EndianEnum { UNDEFINED = 0, LITTLE = 1, BIG = 2 };
26 } // namespace Endian
27 
28 StHyperUtilPlatform::Endian::EndianEnum test_endian();
29 
30 std::string endian_as_string();
31 
32 std::string Arch();
33 
34 } // namespace StHyperUtilPlatform
35 
36 #endif // __ST_HYPERUTILPLATFORM_H