Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
align.h
Go to the documentation of this file.
1 
18 #ifndef ION_PORT_ALIGN_H_
19 #define ION_PORT_ALIGN_H_
20 
30 
33 #if !defined(ION_ALIGNMENT_ENABLED)
34 # if defined(ION_PLATFORM_WINDOWS) || defined(ION_PLATFORM_ANDROID) || \
35  defined(ION_PLATFORM_GENERIC_ARM)
36 # define ION_ALIGNMENT_ENABLED 0
40 # else
41 # define ION_ALIGNMENT_ENABLED 1
42 # endif
43 #endif
44 
45 #if ION_ALIGNMENT_ENABLED
46 # if defined(ION_PLATFORM_WINDOWS)
47 # define ION_ALIGN(num_bytes) __declspec(align(num_bytes))
48 # else
49 # define ION_ALIGN(num_bytes) __attribute__((aligned(num_bytes)))
51 # endif
52 #else
53 # define ION_ALIGN(num_bytes)
54 #endif
55 
56 #if defined(ION_PLATFORM_WINDOWS)
57 #define ION_ALIGNOF(T) __alignof(T)
58 #else
59 #define ION_ALIGNOF(T) __alignof__(T)
60 #endif
61 
62 #endif // ION_PORT_ALIGN_H_