diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 214cb483ca..96ceef6c52 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -3358,15 +3358,15 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx) auto val = static_cast(left)->GetValue().GetUInt(); if (val > INT_MAX) { - ScriptPosition.Message(MSG_WARNING, "Comparison with out of range unsigned constant"); + ScriptPosition.Message(MSG_WARNING, "Comparison of signed value with out of range unsigned constant"); } } else if (right->isConstant() && !left->isConstant()) { auto val = static_cast(right)->GetValue().GetInt(); - if (val > INT_MAX) + if (val < 0) { - ScriptPosition.Message(MSG_WARNING, "Comparison with out of range signed constant"); + ScriptPosition.Message(MSG_WARNING, "Comparison of unsigned value with negative constant"); } } else if (!left->isConstant() && !right->isConstant()) @@ -3379,9 +3379,9 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx) if (left->isConstant() && !right->isConstant()) { auto val = static_cast(left)->GetValue().GetInt(); - if (val > INT_MAX) + if (val < 0) { - ScriptPosition.Message(MSG_WARNING, "Comparison with out of range signed constant"); + ScriptPosition.Message(MSG_WARNING, "Comparison of unsigned value with negative constant"); } } else if (right->isConstant() && !left->isConstant()) @@ -3389,7 +3389,7 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx) auto val = static_cast(right)->GetValue().GetUInt(); if (val > INT_MAX) { - ScriptPosition.Message(MSG_WARNING, "Comparison with out of range unsigned constant"); + ScriptPosition.Message(MSG_WARNING, "Comparison of signed value with out of range unsigned constant"); } } else if (!left->isConstant() && !right->isConstant())