]> rtime.felk.cvut.cz Git - ulut.git/commitdiff
Define UL_ALIGNOF macro to allow adjustments for different compilers.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sun, 14 Sep 2014 00:04:32 +0000 (02:04 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sun, 14 Sep 2014 00:04:32 +0000 (02:04 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
ulut/ul_utdefs.h

index 7cd38a79dc5c99324e4f8cad42f24634cf8421d4..a85614e57ad7cb9e0c3bd4ef8df2d44d540b3b9d 100644 (file)
@@ -66,6 +66,14 @@ extern "C" {
 #endif /*__GNUC__*/
 #endif /*UL_CONTAINEROF*/
 
+#ifndef UL_ALIGNOF
+#ifdef  __GNUC__
+#define        UL_ALIGNOF(_type) __alignof__(_type)
+#else /*__GNUC__*/
+#define        UL_ALIGNOF(_type) UL_OFFSETOF(struct {char _fld0; _type _fld1;}, _fld1)
+#endif /*__GNUC__*/
+#endif /*UL_ALIGNOF*/
+
 #ifndef UL_NOPSTATEMENT
 #define UL_NOPSTATEMENT do { } while(0)
 #endif