#ifndef _UL_UTDEFS_H
#define _UL_UTDEFS_H
+#include <stddef.h> /* For size_t */
+
#ifdef __cplusplus
extern "C" {
#endif
#endif /*__GNUC__*/
#endif /*UL_CONTAINEROF*/
-#ifndef UL_ALIGNOF
+#ifndef UL_ALIGNOF_FIELD
+#define UL_ALIGNOF_FIELD(_type) UL_OFFSETOF(struct {char _fld0; _type _fld1;}, _fld1)
+#endif /*UL_ALIGNOF*/
+
+#ifndef UL_ALIGNOF_TYPE
#ifdef __GNUC__
-#define UL_ALIGNOF(_type) __alignof__(_type)
+/* The compiler provided alignment for performance can differ from ABI struct one */
+#define UL_ALIGNOF_TYPE(_type) __alignof__(_type)
#else /*__GNUC__*/
-#define UL_ALIGNOF(_type) UL_OFFSETOF(struct {char _fld0; _type _fld1;}, _fld1)
+#define UL_ALIGNOF_TYPE UL_ALIGNOF_FIELD
#endif /*__GNUC__*/
#endif /*UL_ALIGNOF*/
+#ifndef UL_ALIGNOF
+#define UL_ALIGNOF UL_ALIGNOF_FIELD
+#endif /*UL_ALIGNOF*/
+
+
#ifndef UL_NOPSTATEMENT
#define UL_NOPSTATEMENT do { } while(0)
#endif