From 96eca4b42f1efc4fbb663dd6994a43fcdf26bf5d Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 18 Mar 2025 21:06:12 +0200 Subject: some header improvements --- include/kmi/types.h | 8 -------- include/kmi/utils.h | 4 ++++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/kmi/types.h b/include/kmi/types.h index 709ca02..fc7cd8c 100644 --- a/include/kmi/types.h +++ b/include/kmi/types.h @@ -127,14 +127,6 @@ typedef uint32_t size_t; typedef int32_t ssize_t; #endif -/** Maximum alignment. Works for most platforms, I think. */ -typedef union { - /** Either the system has an integer as its maximum width */ - intmax_t ll; - /** Or it has a long double. */ - long double ld; -} max_align_t; - /** Expands to integer constant of type \ref int8_t. */ #define INT8_C __INT8_C diff --git a/include/kmi/utils.h b/include/kmi/utils.h index 30b08be..a5bdc02 100644 --- a/include/kmi/utils.h +++ b/include/kmi/utils.h @@ -153,9 +153,13 @@ #if __has_builtin(__builtin_offsetof) #define offsetof(type, member) __builtin_offsetof(type, member) #else + +#if !defined(offsetof) #define offsetof(type, member) ((uintptr_t) &((type *)0)->member) #endif +#endif /* __has_builtin(__builtin_offsetof) */ + /** * Signal to the compiler that some expression is likely to be true. * Might aid in optimisation and branch prediction manipulation. -- cgit v1.3