diff --git a/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs b/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs index 1a3e5925d6b9..0f468822c25b 100644 --- a/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs @@ -214,7 +214,7 @@ internal virtual int GetDatePart(long ticks, int part) 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; + int m = (n >> 5) + 1; // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs b/src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs index f595e72d0d5d..f76d30a2c87f 100644 --- a/src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs +++ b/src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs @@ -248,7 +248,7 @@ internal virtual int GetDatePart(long ticks, int part) 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; + int m = (n >> 5) + 1; // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs b/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs index 9fc6525a444e..a283038948c0 100644 --- a/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs @@ -193,7 +193,7 @@ internal static int GetDatePart(long ticks, int part) int[] days = leapYear ? s_daysToMonth366 : s_daysToMonth365; // All months have less than 32 days, so n >> 5 is a good conservative // estimate for the month - int m = n >> 5 + 1; + int m = (n >> 5) + 1; // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/src/mscorlib/src/System/DateTime.cs b/src/mscorlib/src/System/DateTime.cs index c46454933312..ff8ad295da3b 100644 --- a/src/mscorlib/src/System/DateTime.cs +++ b/src/mscorlib/src/System/DateTime.cs @@ -775,7 +775,7 @@ private int GetDatePart(int part) { 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; + int m = (n >> 5) + 1; // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/src/mscorlib/src/System/Globalization/GregorianCalendar.cs b/src/mscorlib/src/System/Globalization/GregorianCalendar.cs index e540adda9fff..6f4860088751 100644 --- a/src/mscorlib/src/System/Globalization/GregorianCalendar.cs +++ b/src/mscorlib/src/System/Globalization/GregorianCalendar.cs @@ -217,7 +217,7 @@ internal virtual int GetDatePart(long ticks, int part) 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; + int m = (n >> 5) + 1; // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs b/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs index 75b280d4574b..cf3fd44cf92e 100644 --- a/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs +++ b/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs @@ -243,7 +243,7 @@ internal virtual int GetDatePart(long ticks, int part) 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; + int m = (n >> 5) + 1; // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it diff --git a/src/mscorlib/src/System/Globalization/JulianCalendar.cs b/src/mscorlib/src/System/Globalization/JulianCalendar.cs index 9c8db3415cd0..c98254808cb5 100644 --- a/src/mscorlib/src/System/Globalization/JulianCalendar.cs +++ b/src/mscorlib/src/System/Globalization/JulianCalendar.cs @@ -204,7 +204,7 @@ static internal int GetDatePart(long ticks, int part) 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; + int m = (n >> 5) + 1; // m = 1-based month number while (n >= days[m]) m++; // If month was requested, return it