diff --git a/BeefLibs/Beefy2D/src/gfx/Color.bf b/BeefLibs/Beefy2D/src/gfx/Color.bf index 295b1fe7..58e83ab7 100644 --- a/BeefLibs/Beefy2D/src/gfx/Color.bf +++ b/BeefLibs/Beefy2D/src/gfx/Color.bf @@ -77,7 +77,7 @@ namespace Beefy.gfx (((((color1 & 0x000000FF) * oma) + ((color2 & 0x000000FF) * a)) >> 8) & 0x000000FF) | (((((color1 & 0x0000FF00) * oma) + ((color2 & 0x0000FF00) * a)) >> 8) & 0x0000FF00) | (((((color1 & 0x00FF0000) * oma) + ((color2 & 0x00FF0000) * a)) >> 8) & 0x00FF0000) | - (((((color1 >> 24) & 0xFF) * oma) + (((color2 >> 24) & 0xFF) * a) & 0x0000FF00) << 16); + ((((((color1 >> 24) & 0xFF) * oma) + (((color2 >> 24) & 0xFF) * a)) & 0x0000FF00) << 16); return aColor; } diff --git a/BeefLibs/Beefy2D/src/gfx/Font.bf b/BeefLibs/Beefy2D/src/gfx/Font.bf index d82103b8..70c6cf44 100644 --- a/BeefLibs/Beefy2D/src/gfx/Font.bf +++ b/BeefLibs/Beefy2D/src/gfx/Font.bf @@ -897,7 +897,7 @@ namespace Beefy.gfx { // This strange-looking construct is so that odd-length lines and even-length lines do not 'jitter' // relative to each other as we're resizing a window - useX += ((int)(width)&~1 - (int)aWidth) / 2; + useX += (((int)(width)&~1) - (int)aWidth) / 2; } else if (justification == 1) useX += width - aWidth; diff --git a/BeefLibs/corlib/src/DateTime.bf b/BeefLibs/corlib/src/DateTime.bf index f209d2b6..1b3092be 100644 --- a/BeefLibs/corlib/src/DateTime.bf +++ b/BeefLibs/corlib/src/DateTime.bf @@ -284,7 +284,10 @@ namespace System int32[] days = leapYear ? DaysToMonth366 : DaysToMonth365; // All months have less than 32 days, so n >> 5 is a good conservative // estimate for the month - int32 m = n >> 5 + 1; + + //BCF- Note, the original read `int32 m = n >> 5 + 1;`, which may have been a bug. Preserving original precedence. + int32 m = n >> (5 + 1); + // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/BeefLibs/corlib/src/Globalization/GregorianCalendar.bf b/BeefLibs/corlib/src/Globalization/GregorianCalendar.bf index 70d1d762..9b07d146 100644 --- a/BeefLibs/corlib/src/Globalization/GregorianCalendar.bf +++ b/BeefLibs/corlib/src/Globalization/GregorianCalendar.bf @@ -220,7 +220,8 @@ namespace System.Globalization { int[] days = leapYear? DaysToMonth366: DaysToMonth365; // All months have less than 32 days, so n >> 5 is a good conservative // estimate for the month - int m = n >> 5 + 1; + //BCF- Note, the original read `int32 m = n >> 5 + 1;`, which may have been a bug. Preserving original precedence. + int m = n >> (5 + 1); // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/BeefLibs/corlib/src/Reflection/MethodInfo.bf b/BeefLibs/corlib/src/Reflection/MethodInfo.bf index fe42468f..14397d13 100644 --- a/BeefLibs/corlib/src/Reflection/MethodInfo.bf +++ b/BeefLibs/corlib/src/Reflection/MethodInfo.bf @@ -372,7 +372,7 @@ namespace System.Reflection } else if (mMethodData.mVirtualIdx >= 0x100000) { - void* extAddr = (void*)*((int*)classVData + (mMethodData.mVirtualIdx>>20 - 1)); + void* extAddr = (void*)*((int*)classVData + ((mMethodData.mVirtualIdx>>20) - 1)); funcPtr = (void*)*((int*)extAddr + (mMethodData.mVirtualIdx & 0xFFFFF)); } else @@ -706,7 +706,7 @@ namespace System.Reflection } else if (mMethodData.mVirtualIdx >= 0x100000) { - void* extAddr = (void*)*((int*)classVData + (mMethodData.mVirtualIdx>>20 - 1)); + void* extAddr = (void*)*((int*)classVData + ((mMethodData.mVirtualIdx>>20) - 1)); funcPtr = (void*)*((int*)extAddr + (mMethodData.mVirtualIdx & 0xFFFFF) + virtualOffset); } else diff --git a/BeefLibs/corlib/src/Text/UTF16.bf b/BeefLibs/corlib/src/Text/UTF16.bf index 651c5cd3..4a4953f2 100644 --- a/BeefLibs/corlib/src/Text/UTF16.bf +++ b/BeefLibs/corlib/src/Text/UTF16.bf @@ -29,7 +29,7 @@ namespace System.Text else if ((c >= '\u{DC00}') && (c < '\u{E000}')) { char16 utf16lo = c; - c32 = (char32)(0x10000 + ((uint32)(utf16hi - 0xD800) << 10) | (uint32)(utf16lo - 0xDC00)); + c32 = (char32)(0x10000 | ((uint32)(utf16hi - 0xD800) << 10) | (uint32)(utf16lo - 0xDC00)); } outStr.Append(c32); @@ -56,7 +56,7 @@ namespace System.Text else if ((c >= '\u{DC00}') && (c < '\u{E000}')) { char16 utf16lo = c; - c32 = (char32)(0x10000 + ((uint32)(utf16hi - 0xD800) << 10) | (uint32)(utf16lo - 0xDC00)); + c32 = (char32)(0x10000 | ((uint32)(utf16hi - 0xD800) << 10) | (uint32)(utf16lo - 0xDC00)); } outStr.Append(c32); @@ -83,7 +83,7 @@ namespace System.Text #endif return ((char32)c, 1); } - char32 c32 = (char32)(0x10000 + ((uint32)(c - 0xD800) << 10) | (uint32)(utf16lo - 0xDC00)); + char32 c32 = (char32)(0x10000 | ((uint32)(c - 0xD800) << 10) | (uint32)(utf16lo - 0xDC00)); return (c32, 2); } #if BF_UTF_PEDANTIC diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 25961724..69ef0032 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -20512,7 +20512,9 @@ void BfExprEvaluator::Visit(BfBinaryOperatorExpression* binOpExpr) } } - if ((binOpExpr->mOp == BfBinaryOp_LeftShift) || (binOpExpr->mOp == BfBinaryOp_RightShift)) + if ((binOpExpr->mOp == BfBinaryOp_LeftShift) || (binOpExpr->mOp == BfBinaryOp_RightShift) || + (binOpExpr->mOp == BfBinaryOp_BitwiseAnd) || (binOpExpr->mOp == BfBinaryOp_BitwiseOr) || + (binOpExpr->mOp == BfBinaryOp_ExclusiveOr)) { for (int side = 0; side < 2; side++) {