From ff53669ed918c87d15ddea2d07fda84d4c8eff5d Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 28 Jun 2017 11:39:40 -0700 Subject: Store integer literals at high precision in AST The lexer was creating an `unsigned long long` value, and then the AST was storing it in an `int`. This change makes both use a `long long`. This is obviously still a stopgap until I can get arbitrary precisions in here. --- source/slang/check.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source/slang/check.cpp') diff --git a/source/slang/check.cpp b/source/slang/check.cpp index dfa726150..1424f6728 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -1155,9 +1155,9 @@ namespace Slang hlslNumThreadsAttribute->Position = hlslUncheckedAttribute->Position; hlslNumThreadsAttribute->nameToken = hlslUncheckedAttribute->nameToken; hlslNumThreadsAttribute->args = hlslUncheckedAttribute->args; - hlslNumThreadsAttribute->x = xVal->value; - hlslNumThreadsAttribute->y = yVal->value; - hlslNumThreadsAttribute->z = zVal->value; + hlslNumThreadsAttribute->x = (int32_t) xVal->value; + hlslNumThreadsAttribute->y = (int32_t) yVal->value; + hlslNumThreadsAttribute->z = (int32_t) zVal->value; return hlslNumThreadsAttribute; } @@ -1683,7 +1683,7 @@ namespace Slang return stmt; } - int GetMinBound(RefPtr val) + IntegerLiteralValue GetMinBound(RefPtr val) { if (auto constantVal = val.As()) return constantVal->value; @@ -1913,7 +1913,7 @@ namespace Slang IntVal* GetIntVal(ConstantExpressionSyntaxNode* expr) { // TODO(tfoley): don't keep allocating here! - return new ConstantIntVal(expr->IntValue); + return new ConstantIntVal(expr->integerValue); } RefPtr TryConstantFoldExpr( @@ -1939,7 +1939,7 @@ namespace Slang // Before checking the operation name, let's look at the arguments RefPtr argVals[kMaxArgs]; - int constArgVals[kMaxArgs]; + IntegerLiteralValue constArgVals[kMaxArgs]; int argCount = 0; bool allConst = true; for (auto argExpr : invokeExpr->Arguments) @@ -1977,7 +1977,7 @@ namespace Slang } // At this point, all the operands had simple integer values, so we are golden. - int resultValue = 0; + IntegerLiteralValue resultValue = 0; auto opName = funcDeclRef.GetName(); // handle binary operators @@ -4674,15 +4674,15 @@ namespace Slang } RefPtr CheckSwizzleExpr( - MemberExpressionSyntaxNode* memberRefExpr, - RefPtr baseElementType, - int baseElementCount) + MemberExpressionSyntaxNode* memberRefExpr, + RefPtr baseElementType, + IntegerLiteralValue baseElementCount) { RefPtr swizExpr = new SwizzleExpr(); swizExpr->Position = memberRefExpr->Position; swizExpr->base = memberRefExpr->BaseExpression; - int limitElement = baseElementCount; + IntegerLiteralValue limitElement = baseElementCount; int elementIndices[4]; int elementCount = 0; -- cgit v1.2.3