Skip to content

Commit

Permalink
Fix exceptions thrown by LDiv/LMod helpers (dotnet#98474)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipnavara authored Feb 15, 2024
1 parent c7253b1 commit 741c0c8
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ public static long LMod(long i, long j)
{
if (j == 0)
return ThrowLngDivByZero();
else if (j == -1 && i == long.MinValue)
return ThrowLngOvf();
else
return RhpLMod(i, j);
}
Expand All @@ -189,7 +191,7 @@ public static long LDiv(long i, long j)
if (j == 0)
return ThrowLngDivByZero();
else if (j == -1 && i == long.MinValue)
return ThrowLngArithExc();
return ThrowLngOvf();
else
return RhpLDiv(i, j);
}
Expand All @@ -205,12 +207,6 @@ private static ulong ThrowULngDivByZero()
{
throw new DivideByZeroException();
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static long ThrowLngArithExc()
{
throw new ArithmeticException();
}
#endif // TARGET_64BIT

[RuntimeExport("Dbl2IntOvf")]
Expand Down

0 comments on commit 741c0c8

Please sign in to comment.