mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 08:30:25 +02:00
Fixed operator precedence issues
This commit is contained in:
parent
d0c9145655
commit
2ac478509e
7 changed files with 16 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue