changeset 1165:226c07c71967

This should fix integers below 64 bit on big-endian systems.
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 29 Mar 2009 01:29:30 +0100
parents 166042b48c28
children c6f39553b702
files dmd/lexer.c dmd/lexer.h dmd/parse.c
diffstat 3 files changed, 5 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/lexer.c	Sat Mar 28 21:10:53 2009 +0100
+++ b/dmd/lexer.c	Sun Mar 29 01:29:30 2009 +0100
@@ -118,22 +118,14 @@
     switch (value)
     {
 	case TOKint32v:
-#if IN_GCC
 	    sprintf(buffer,"%d",(d_int32)int64value);
-#else
-	    sprintf(buffer,"%d",int32value);
-#endif
 	    break;
 
 	case TOKuns32v:
 	case TOKcharv:
 	case TOKwcharv:
 	case TOKdcharv:
-#if IN_GCC
 	    sprintf(buffer,"%uU",(d_uns32)uns64value);
-#else
-	    sprintf(buffer,"%uU",uns32value);
-#endif
 	    break;
 
 	case TOKint64v:
--- a/dmd/lexer.h	Sat Mar 28 21:10:53 2009 +0100
+++ b/dmd/lexer.h	Sun Mar 29 01:29:30 2009 +0100
@@ -217,8 +217,6 @@
     union
     {
 	// Integers
-	d_int32 int32value;
-	d_uns32	uns32value;
 	d_int64	int64value;
 	d_uns64	uns64value;
 
--- a/dmd/parse.c	Sat Mar 28 21:10:53 2009 +0100
+++ b/dmd/parse.c	Sun Mar 29 01:29:30 2009 +0100
@@ -3985,12 +3985,12 @@
 	    break;
 
 	case TOKint32v:
-	    e = new IntegerExp(loc, token.int32value, Type::tint32);
+	    e = new IntegerExp(loc, (d_int32)token.int64value, Type::tint32);
 	    nextToken();
 	    break;
 
 	case TOKuns32v:
-	    e = new IntegerExp(loc, token.uns32value, Type::tuns32);
+	    e = new IntegerExp(loc, (d_uns32)token.uns64value, Type::tuns32);
 	    nextToken();
 	    break;
 
@@ -4064,17 +4064,17 @@
 	    break;
 
 	case TOKcharv:
-	    e = new IntegerExp(loc, token.uns32value, Type::tchar);
+	    e = new IntegerExp(loc, (d_uns8)token.uns64value, Type::tchar);
 	    nextToken();
 	    break;
 
 	case TOKwcharv:
-	    e = new IntegerExp(loc, token.uns32value, Type::twchar);
+	    e = new IntegerExp(loc, (d_uns16)token.uns64value, Type::twchar);
 	    nextToken();
 	    break;
 
 	case TOKdcharv:
-	    e = new IntegerExp(loc, token.uns32value, Type::tdchar);
+	    e = new IntegerExp(loc, (d_uns32)token.uns64value, Type::tdchar);
 	    nextToken();
 	    break;