Copy change to XsdDateTime (#1319)
authorts2do <tsdodo@gmail.com>
Mon, 6 Jan 2020 21:57:32 +0000 (15:57 -0600)
committerStephen Toub <stoub@microsoft.com>
Mon, 6 Jan 2020 21:57:32 +0000 (16:57 -0500)
I copied the change from dotnet/coreclr#7769 to XsdDateTime which eliminates extraneous iterations of the days array.

src/libraries/System.Private.Xml/src/System/Xml/Schema/XsdDateTime.cs

index 2707825..82d2b5d 100644 (file)
@@ -612,7 +612,7 @@ namespace System.Xml.Schema
             int[] days = leapYear ? DaysToMonth366 : DaysToMonth365;
             // All months have less than 32 days, so n >> 5 is a good conservative
             // estimate for the month
-            month = n >> 5 + 1;
+            month = (n >> 5) + 1;
             // m = 1-based month number
             while (n >= days[month])
                 month++;