mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed erroneous 'int' widening during binary operation
This commit is contained in:
parent
3a8e4ebc9d
commit
7a4a7bd2fb
1 changed files with 4 additions and 1 deletions
|
@ -20850,6 +20850,7 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
|
|||
}
|
||||
|
||||
BfType* wantType = leftValue.mType;
|
||||
BfType* origWantType = wantType;
|
||||
if ((binaryOp == BfBinaryOp_LeftShift) || (binaryOp == BfBinaryOp_RightShift))
|
||||
wantType = NULL; // Don't presume
|
||||
wantType = mModule->FixIntUnknown(wantType);
|
||||
|
@ -20858,7 +20859,9 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
|
|||
return;
|
||||
|
||||
BfType* rightWantType = wantType;
|
||||
if ((mExpectingType != NULL) && (wantType != NULL) && (mExpectingType->IsIntegral()) && (wantType->IsIntegral()) && (mExpectingType->mSize > wantType->mSize) &&
|
||||
if (origWantType->IsIntUnknown())
|
||||
rightWantType = NULL;
|
||||
else if ((mExpectingType != NULL) && (wantType != NULL) && (mExpectingType->IsIntegral()) && (wantType->IsIntegral()) && (mExpectingType->mSize > wantType->mSize) &&
|
||||
((binaryOp == BfBinaryOp_Add) || (binaryOp == BfBinaryOp_Subtract) || (binaryOp == BfBinaryOp_Multiply)))
|
||||
rightWantType = mExpectingType;
|
||||
rightValue = mModule->CreateValueFromExpression(rightExpression, rightWantType, (BfEvalExprFlags)((mBfEvalExprFlags & BfEvalExprFlags_InheritFlags) | BfEvalExprFlags_NoCast));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue