Skip to content

Commit f08fba3

Browse files
authored
Throw division by zero through separate method
1 parent 14738e0 commit f08fba3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Nethermind.Int256/UInt256.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ private static void Udivrem(ref ulong quot, ref ulong u, int length, in UInt256
704704
}
705705
else
706706
{
707-
throw new DivideByZeroException();
707+
ThrowDivideByZeroException("d == 0");
708708
}
709709

710710
int uLen = 0;
@@ -1430,7 +1430,7 @@ internal static (ulong quo, ulong rem) Div64(ulong hi, ulong lo, ulong y)
14301430
const ulong mask32 = two32 - 1;
14311431
if (y == 0)
14321432
{
1433-
ThrowDivideByZeroException();
1433+
ThrowDivideByZeroException("y == 0");
14341434
}
14351435

14361436
if (y <= hi)
@@ -2223,7 +2223,7 @@ public object ToType(Type conversionType, IFormatProvider? provider) =>
22232223
public ulong ToUInt64(IFormatProvider? provider) => System.Convert.ToUInt64(ToDecimal(provider), provider);
22242224

22252225
[DoesNotReturn]
2226-
private static void ThrowDivideByZeroException() => throw new DivideByZeroException("y == 0");
2226+
private static void ThrowDivideByZeroException(string message) => throw new DivideByZeroException(message);
22272227

22282228
[DoesNotReturn]
22292229
private static void ThrowOverflowException(string message) => throw new OverflowException(message);

0 commit comments

Comments
 (0)