Skip to content

Commit

Permalink
Don't use Unsafe in TimeSpanParse.Pow10
Browse files Browse the repository at this point in the history
  • Loading branch information
lilinus committed Apr 27, 2024
1 parent 7800524 commit decf099
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@

using System.Buffers.Text;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;

namespace System.Globalization
Expand Down Expand Up @@ -581,7 +579,7 @@ internal static int Pow10(int pow)
10000000,
];
Debug.Assert(powersOfTen.Length == MaxFractionDigits + 1);
return Unsafe.Add(ref MemoryMarshal.GetReference(powersOfTen), pow);
return powersOfTen[pow];
}

private static bool TryTimeToTicks(bool positive, TimeSpanToken days, TimeSpanToken hours, TimeSpanToken minutes, TimeSpanToken seconds, TimeSpanToken fraction, out long result)
Expand Down

0 comments on commit decf099

Please sign in to comment.