summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-14 00:52:30 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-17 22:50:16 +0100
commit01bd0384f3a1bcba7a129418af7acb4087dd8904 (patch)
treeac111cecc10f209021d55aeba421b0de6da3b88c
parent03a5abff482bea1654c76dbfb49bfbd1164d8e8a (diff)
downloadsparse-01bd0384f3a1bcba7a129418af7acb4087dd8904.tar.gz
fix the size of long double
The odd one here is, of course i386, with its 80-bit extended floats taking 12 bytes. Idem for __m68k__. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--target.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/target.c b/target.c
index 12cd219a..788ef3fa 100644
--- a/target.c
+++ b/target.c
@@ -38,9 +38,9 @@ int max_int_alignment = 4;
*/
int bits_in_float = 32;
int bits_in_double = 64;
-int bits_in_longdouble = 80;
+int bits_in_longdouble = 128;
-int max_fp_alignment = 8;
+int max_fp_alignment = 16;
/*
* Pointer data type
@@ -93,6 +93,27 @@ void init_target(void)
break;
}
+ switch (arch_mach) {
+ case MACH_ARM:
+ case MACH_MIPS32:
+ case MACH_S390X:
+ case MACH_SPARC32:
+ bits_in_longdouble = 64;
+ max_fp_alignment = 8;
+ break;
+ case MACH_X86_64:
+ if (arch_m64 == ARCH_LP64 || arch_m64 == ARCH_X32)
+ break;
+ /* fall through */
+ case MACH_I386:
+ case MACH_M68K:
+ bits_in_longdouble = 96;
+ max_fp_alignment = 4;
+ break;
+ default:
+ break;
+ }
+
#if defined(__CYGWIN__)
wchar_ctype = &ushort_ctype;
#endif