changeset 1011:010b8b67de1a

Apply previous changes to dmd2/mtype.c as well.
author Frits van Bommel <fvbommel wxs.nl>
date Sat, 28 Feb 2009 17:44:53 +0100
parents bad2044a1597
children 39cf8fa483fd
files dmd2/mtype.c
diffstat 1 files changed, 9 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/dmd2/mtype.c	Sat Feb 28 17:35:45 2009 +0100
+++ b/dmd2/mtype.c	Sat Feb 28 17:44:53 2009 +0100
@@ -9,7 +9,7 @@
 // See the included readme.txt for details.
 
 #define __USE_ISOC99 1		// so signbit() gets defined
-#include <math.h>
+#include <cmath>
 
 #include <stdio.h>
 #include <assert.h>
@@ -32,13 +32,13 @@
 #endif
 
 #if __APPLE__
-#include <math.h>
+#include <cmath>
 static double zero = 0;
 #elif __MINGW32__
-#include <math.h>
+#include <cmath>
 static double zero = 0;
 #elif __GNUC__
-#include <math.h>
+#include <cmath>
 #include <bits/nan.h>
 #include <bits/mathdef.h>
 static double zero = 0;
@@ -60,6 +60,8 @@
 #include "aggregate.h"
 #include "hdrgen.h"
 
+#include "gen/tollvm.h"
+
 FuncDeclaration *hasThis(Scope *sc);
 
 
@@ -1229,38 +1231,8 @@
 }
 
 unsigned TypeBasic::alignsize()
-{   unsigned sz;
-
-    //LDC: it's bad that we always have to check LLVM's align and
-    // dmd's align info match. Can't we somehow get at LLVM's align
-    // here?
-
-    switch (ty)
-    {
-	case Tfloat80:
-	case Timaginary80:
-	case Tcomplex80:
-	    if (global.params.cpu == ARCHx86_64)
-		sz = 16;
-	    else
-		sz = 4;
-	    break;
-
-	case Tint64:
-	case Tuns64:
-	case Tfloat64:
-	case Timaginary64:
-	    if (global.params.cpu == ARCHx86_64)
-		sz = 8;
-	    else
-		sz = 4;
-	    break;
-
-	default:
-	    sz = size(0);
-	    break;
-    }
-    return sz;
+{
+    return getABITypeAlign(DtoType(this));
 }
 
 
@@ -1354,7 +1326,7 @@
 		// constant folding.
 		volatile d_float80 foo;
 		foo = NAN;
-		if (signbit(foo))	// signbit sometimes, not always, set
+		if (std::signbit(foo))	// signbit sometimes, not always, set
 		    foo = -foo;		// turn off sign bit
 		fvalue = foo;
 #elif _MSC_VER