| 1 | #ifndef _NT_STDALIGN_H_ |
| 2 | #define _NT_STDALIGN_H_ |
| 3 | |
| 4 | /* This header has the necessary stuff from lib/stdalign.in.h, but |
| 5 | avoids the need to have Sed at build time. */ |
| 6 | |
| 7 | #include <stddef.h> |
| 8 | #if defined __cplusplus |
| 9 | template <class __t> struct __alignof_helper { char __a; __t __b; }; |
| 10 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) |
| 11 | #else |
| 12 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) |
| 13 | #endif |
| 14 | #define alignof _Alignof |
| 15 | |
| 16 | #if __GNUC__ |
| 17 | # define _Alignas(a) __attribute__ ((__aligned__ (a))) |
| 18 | #elif 1300 <= _MSC_VER |
| 19 | # define _Alignas(a) __declspec (align (a)) |
| 20 | #endif |
| 21 | #ifdef _Alignas |
| 22 | # define alignas _Alignas |
| 23 | #endif |
| 24 | |
| 25 | #endif /* _NT_STDALIGN_H_ */ |