Fixed month calculating issue of calendars(#7666) (#7769)
authorJim Ma <mazong1123@gmail.com>
Sat, 22 Oct 2016 16:19:57 +0000 (00:19 +0800)
committerJan Kotas <jkotas@microsoft.com>
Sat, 22 Oct 2016 16:19:57 +0000 (09:19 -0700)
Fixed the issue introduced by misunderstanding the precedence of '+' and
'>>'.

fix #7666

src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs
src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs
src/mscorlib/corefx/System/Globalization/JulianCalendar.cs
src/mscorlib/src/System/DateTime.cs
src/mscorlib/src/System/Globalization/GregorianCalendar.cs
src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs
src/mscorlib/src/System/Globalization/JulianCalendar.cs

index 1a3e592..0f46882 100644 (file)
@@ -214,7 +214,7 @@ 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;
+            int m = (n >> 5) + 1;
             // m = 1-based month number
             while (n >= days[m]) m++;
             // If month was requested, return it
index f595e72..f76d30a 100644 (file)
@@ -248,7 +248,7 @@ 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;
+            int m = (n >> 5) + 1;
             // m = 1-based month number
             while (n >= days[m]) m++;
             // If month was requested, return it
index 9fc6525..a283038 100644 (file)
@@ -193,7 +193,7 @@ namespace System.Globalization
             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
index c464549..ff8ad29 100644 (file)
@@ -775,7 +775,7 @@ namespace System {
             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
index e540add..6f48600 100644 (file)
@@ -217,7 +217,7 @@ 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;
+            int m = (n >> 5) + 1;
             // m = 1-based month number
             while (n >= days[m]) m++;
             // If month was requested, return it
index 75b280d..cf3fd44 100644 (file)
@@ -243,7 +243,7 @@ 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;
+            int m = (n >> 5) + 1;
             // m = 1-based month number
             while (n >= days[m]) m++;
             // If month was requested, return it
index 9c8db34..c982548 100644 (file)
@@ -204,7 +204,7 @@ 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;
+            int m = (n >> 5) + 1;
             // m = 1-based month number
             while (n >= days[m]) m++;
             // If month was requested, return it