public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Add __packed to struct ldieee
@ 2017-04-18 10:27 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2017-04-18 10:27 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c23fbc3aedd0c25c0b0c34402e53328bffa692de
commit c23fbc3aedd0c25c0b0c34402e53328bffa692de
Author: Kito Cheng <kito.cheng@gmail.com>
Date: Sun Apr 9 00:06:06 2017 +0800
Add __packed to struct ldieee
- We don't want any padding in struct ldieee, otherwise the offset
might wrong in most compiler.
Diff:
---
newlib/libc/stdio/vfieeefp.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/newlib/libc/stdio/vfieeefp.h b/newlib/libc/stdio/vfieeefp.h
index 7169119..e85cabb 100644
--- a/newlib/libc/stdio/vfieeefp.h
+++ b/newlib/libc/stdio/vfieeefp.h
@@ -35,6 +35,7 @@
#include <float.h>
#include <errno.h>
#include <sys/config.h>
+#include <sys/cdefs.h>
#ifdef __IEEE_LITTLE_ENDIAN
#define IEEE_8087
@@ -71,7 +72,7 @@ struct ldieee
unsigned manh:23;
unsigned exp:8;
unsigned sign:1;
-};
+} __packed;
#elif LDBL_MANT_DIG == 53
struct ldieee
{
@@ -79,7 +80,7 @@ struct ldieee
unsigned manh:32;
unsigned exp:11;
unsigned sign:1;
-};
+} __packed;
#elif LDBL_MANT_DIG == 64
struct ldieee
{
@@ -87,7 +88,7 @@ struct ldieee
unsigned manh:32;
unsigned exp:15;
unsigned sign:1;
-};
+} __packed;
#elif LDBL_MANT_DIG > 64
struct ldieee
{
@@ -97,7 +98,7 @@ struct ldieee
unsigned manh:32;
unsigned exp:15;
unsigned sign:1;
-};
+} __packed;
#endif /* LDBL_MANT_DIG */
#else /* !IEEE_8087 */
#if LDBL_MANT_DIG == 24
@@ -106,7 +107,7 @@ struct ldieee
unsigned sign:1;
unsigned exp:8;
unsigned manh:23;
-};
+} __packed;
#elif LDBL_MANT_DIG == 53
struct ldieee
{
@@ -114,7 +115,7 @@ struct ldieee
unsigned exp:11;
unsigned manh:32;
unsigned manl:20;
-};
+} __packed;
#elif LDBL_MANT_DIG == 64
struct ldieee
{
@@ -122,7 +123,7 @@ struct ldieee
unsigned exp:15;
unsigned manh:32;
unsigned manl:32;
-};
+} __packed;
#elif LDBL_MANT_DIG > 64
struct ldieee
{
@@ -132,7 +133,7 @@ struct ldieee
unsigned manl:32;
unsigned manl2:32;
unsigned manl3:16;
-};
+} __packed;
#endif /* LDBL_MANT_DIG */
#endif /* !IEEE_8087 */
#endif /* _WANT_IO_LONG_DOUBLE */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-18 10:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18 10:27 [newlib-cygwin] Add __packed to struct ldieee Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).