Skip to content

Commit

Permalink
Improve 'r1 = ' comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeiPavlov committed Aug 3, 2022
1 parent de9a57a commit 39a504a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libraries/System.Private.CoreLib/src/System/DateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ public DateTime Date
internal void GetDate(out int year, out int month, out int day)
{
// y100 = number of whole 100-year periods since 3/1/0000
// r1 = (day number within 100-year period) * 4
// r1 = (day number within 100-year period) * 4 + 3
(uint y100, uint r1) = Math.DivRem(((uint)(UTicks / TicksPer6Hours) | 3U) + 1224, DaysPer400Years);
ulong u2 = (ulong)Math.BigMul(2939745, (int)r1 | 3);
ushort daySinceMarch1 = (ushort)((uint)u2 / 11758980);
Expand Down Expand Up @@ -1419,7 +1419,7 @@ public int Day
{
get
{
// r1 = (day number within 100-year period) * 4
// r1 = (day number within 100-year period) * 4 + 3
uint r1 = (((uint)(UTicks / TicksPer6Hours) | 3U) + 1224) % DaysPer400Years;
ulong u2 = (ulong)Math.BigMul(2939745, (int)r1 | 3);
ushort daySinceMarch1 = (ushort)((uint)u2 / 11758980);
Expand Down Expand Up @@ -1496,7 +1496,7 @@ public int Month
{
get
{
// r1 = (day number within 100-year period) * 4
// r1 = (day number within 100-year period) * 4 + 3
uint r1 = (((uint)(UTicks / TicksPer6Hours) | 3U) + 1224) % DaysPer400Years;
ulong u2 = (ulong)Math.BigMul(2939745, (int)r1 | 3);
ushort daySinceMarch1 = (ushort)((uint)u2 / 11758980);
Expand Down Expand Up @@ -1556,7 +1556,7 @@ public int Year
get
{
// y100 = number of whole 100-year periods since 1/1/0001
// r1 = (day number within 100-year period) * 4
// r1 = (day number within 100-year period) * 4 + 3
(uint y100, uint r1) = Math.DivRem(((uint)(UTicks / TicksPer6Hours) | 3U), DaysPer400Years);
return 100 * (int)y100
+ ((int)r1 | 3) / DaysPer4Years
Expand Down

0 comments on commit 39a504a

Please sign in to comment.