diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index 8a978d4..7da13b7 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -464,6 +464,11 @@ Expression* Expression::ConstantFold(Errors * errors) ex->mDecType = mLeft->mDecType; return ex; } + else if (mType == EX_BINARY && mToken == TK_ADD && mLeft->mType == EX_VARIABLE && mLeft->mDecValue->mType == DT_VARIABLE && (mLeft->mDecValue->mFlags & DTF_CONST) && mLeft->mDecType->mType == DT_TYPE_POINTER && mRight->mType == EX_CONSTANT && mRight->mDecValue->mType == DT_CONST_INTEGER) + { + mLeft = mLeft->mDecValue->mValue; + return this->ConstantFold(errors); + } else if (mType == EX_QUALIFY && mLeft->mType == EX_VARIABLE && mLeft->mDecValue->mType == DT_VARIABLE && (mLeft->mDecValue->mFlags & DTF_GLOBAL) && mLeft->mDecType->mType == DT_TYPE_STRUCT) { Expression* ex = new Expression(mLocation, EX_VARIABLE); diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index df31a00..936966e 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -5653,7 +5653,7 @@ int NativeCodeBasicBlock::ShortMultiply(InterCodeProcedure* proc, NativeCodeProc lshift++; } - if (mul > 1 && (lshift > 3 || lmul != 1) && ins->mSrc[index].IsUByte() && ins->mSrc[index].mRange.mMaxValue < 16) + if (mul > 1 && ((lshift & 7) > 3 || lmul != 1) && ins->mSrc[index].IsUByte() && ins->mSrc[index].mRange.mMaxValue < 16) { int dreg = BC_REG_TMP + proc->mTempOffset[ins->mDst.mTemp];