From 2586278349ee51ebef694338357794b1211fcefd Mon Sep 17 00:00:00 2001 From: Frits van Bommel Date: Sun, 29 Mar 2009 01:29:30 +0100 Subject: [PATCH] This should fix integers below 64 bit on big-endian systems. --- dmd/lexer.c | 8 -------- dmd/lexer.h | 2 -- dmd/parse.c | 10 +++++----- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/dmd/lexer.c b/dmd/lexer.c index 9031ec70..b9444a19 100644 --- a/dmd/lexer.c +++ b/dmd/lexer.c @@ -118,22 +118,14 @@ const char *Token::toChars() 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: diff --git a/dmd/lexer.h b/dmd/lexer.h index aaaaee3f..051be775 100644 --- a/dmd/lexer.h +++ b/dmd/lexer.h @@ -217,8 +217,6 @@ struct Token union { // Integers - d_int32 int32value; - d_uns32 uns32value; d_int64 int64value; d_uns64 uns64value; diff --git a/dmd/parse.c b/dmd/parse.c index 95c89474..db9a9b22 100644 --- a/dmd/parse.c +++ b/dmd/parse.c @@ -3985,12 +3985,12 @@ Expression *Parser::parsePrimaryExp() 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 @@ Expression *Parser::parsePrimaryExp() 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;