aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-03-18 21:06:12 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-03-18 21:06:12 +0200
commit96eca4b42f1efc4fbb663dd6994a43fcdf26bf5d (patch)
treedb36c84a347931349d9cd5c6460d9cc6f57124ea /include
parent3b94d29f866e4ce4cc802d23c8770b08e70a02e1 (diff)
downloadkmi-96eca4b42f1efc4fbb663dd6994a43fcdf26bf5d.tar.gz
kmi-96eca4b42f1efc4fbb663dd6994a43fcdf26bf5d.zip
some header improvements
Diffstat (limited to 'include')
-rw-r--r--include/kmi/types.h8
-rw-r--r--include/kmi/utils.h4
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.