Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 30 Apr 2014 22:23:01 +0200
From: Pawel Dziepak <pdziepak@...rnos.org>
To: musl@...ts.openwall.com
Cc: Pawel Dziepak <pdziepak@...rnos.org>
Subject: [PATCH] add definition of max_align_t to stddef.h

max_align_t is an object type with the strictest alignment supported by
the implementation in all contexts. An union is used to "choose" the greater
of the two greatest scalar types: long long and long double.

Signed-off-by: Pawel Dziepak <pdziepak@...rnos.org>
---
 include/alltypes.h.in | 2 ++
 include/stddef.h      | 1 +
 2 files changed, 3 insertions(+)

diff --git a/include/alltypes.h.in b/include/alltypes.h.in
index c4ca5d5..ec3873f 100644
--- a/include/alltypes.h.in
+++ b/include/alltypes.h.in
@@ -18,6 +18,8 @@ TYPEDEF unsigned _Int64 uint64_t;
 TYPEDEF unsigned _Int64 u_int64_t;
 TYPEDEF unsigned _Int64 uintmax_t;
 
+TYPEDEF union { long double ld; long long ll; } max_align_t;
+
 TYPEDEF unsigned mode_t;
 TYPEDEF unsigned _Reg nlink_t;
 TYPEDEF _Int64 off_t;
diff --git a/include/stddef.h b/include/stddef.h
index 0a32919..cab34d9 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -7,6 +7,7 @@
 #define NULL ((void*)0)
 #endif
 
+#define __NEED_max_align_t
 #define __NEED_ptrdiff_t
 #define __NEED_size_t
 #define __NEED_wchar_t
-- 
1.9.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.