From f7f9746a0ff11c84ce5869a6a7b552e9a12f8f45 Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Mon, 1 Aug 2022 23:11:21 -0500 Subject: [PATCH] Don't throw away unsignedness when passing unsigned constants to the codegen --- src/common/scripting/frontend/zcc_compile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/scripting/frontend/zcc_compile.cpp b/src/common/scripting/frontend/zcc_compile.cpp index 66d68b9b4d..79b5feb801 100644 --- a/src/common/scripting/frontend/zcc_compile.cpp +++ b/src/common/scripting/frontend/zcc_compile.cpp @@ -2808,7 +2808,14 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast, bool substitute) } else if (cnst->Type->isInt()) { - return new FxConstant(cnst->IntVal, *ast); + if (cnst->Type == TypeUInt32) + { + return new FxConstant((unsigned)cnst->IntVal, *ast); + } + else + { + return new FxConstant(cnst->IntVal, *ast); + } } else if (cnst->Type == TypeBool) {