Skip to content

Commit 4cfbf69

Browse files
authored
Throw OverflowException rather than ArithmeticException - better defi… (#39)
* Throw OverflowException rather than ArithmeticException - better defined exception should be thrown * simplify * fix
1 parent 437c8ad commit 4cfbf69

File tree

2 files changed

+117
-120
lines changed

2 files changed

+117
-120
lines changed

src/Nethermind.Int256.Test/UInt256Tests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public virtual void Subtract((BigInteger A, BigInteger B) test)
100100

101101
resUInt256.Should().Be(resBigInt);
102102
}
103-
103+
104104
[TestCaseSource(typeof(TernaryOps), nameof(TernaryOps.TestCases))]
105105
public virtual void SubtractMod((BigInteger A, BigInteger B, BigInteger M) test)
106106
{
@@ -162,7 +162,7 @@ public virtual void SubtractOverflow((BigInteger A, BigInteger B) test)
162162
if (uint256a is UInt256 a && uint256b is UInt256 b)
163163
{
164164
a.Invoking(y => y - b)
165-
.Should().Throw<ArithmeticException>()
165+
.Should().Throw<OverflowException>()
166166
.WithMessage($"Underflow in subtraction {a} - {b}");
167167
}
168168
else
@@ -224,7 +224,7 @@ public virtual void Div((BigInteger A, BigInteger B) test)
224224

225225
resUInt256.Should().Be(resBigInt);
226226
}
227-
227+
228228
[TestCaseSource(typeof(BinaryOps), nameof(BinaryOps.TestCases))]
229229
public virtual void And((BigInteger A, BigInteger B) test)
230230
{
@@ -412,21 +412,21 @@ public virtual void Max_value_is_correct()
412412
{
413413
convert(1).MaximalValue.Should().Be(convert(maxValue));
414414
}
415-
415+
416416
[Test]
417417
public virtual void ToBigEndian_And_Back()
418418
{
419419
byte[] bidEndian = convert(1000000000000000000).ToBigEndian();
420420
new UInt256(bidEndian, true).Should().Be(convert(1000000000000000000));
421421
}
422-
422+
423423
[Test]
424424
public virtual void ToLittleEndian_And_Back()
425425
{
426426
byte[] bidEndian = convert(1000000000000000000).ToLittleEndian();
427427
new UInt256(bidEndian).Should().Be(convert(1000000000000000000));
428428
}
429-
429+
430430
[Test]
431431
public virtual void Check_For_Correct_Big_And_Little_Endian()
432432
{
@@ -436,14 +436,14 @@ public virtual void Check_For_Correct_Big_And_Little_Endian()
436436
0, 0
437437
};
438438
convert(1000000000000000000).ToBigEndian().Should().BeEquivalentTo(bigEndianRepresentation);
439-
439+
440440
byte[] littleEndianRepresentation =
441441
{
442442
0, 0, 100, 167, 179, 182, 224, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
443443
};
444444
convert(1000000000000000000).ToLittleEndian().Should().BeEquivalentTo(littleEndianRepresentation);
445445
}
446-
446+
447447
[TestCaseSource(typeof(Convertibles), nameof(Convertibles.TestCases))]
448448
public void Convert(Type type, object value, Type expectedException, string expectedString)
449449
{

src/Nethermind.Int256/UInt256.cs

Lines changed: 109 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -309,91 +309,91 @@ public bool IsOne
309309
public bool IsZeroOrOne => ((u0 >> 1) | u1 | u2 | u3) == 0;
310310

311311
public UInt256 ZeroValue => Zero;
312-
312+
313313
public UInt256 OneValue => One;
314314

315315
public UInt256 MaximalValue => MaxValue;
316316

317317
private static ReadOnlySpan<byte> s_broadcastLookup => new byte[] {
318-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
322-
323-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327-
328-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332-
333-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
335-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
336-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337-
338-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342-
343-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347-
348-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
350-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352-
353-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
354-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
356-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357-
358-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
359-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
361-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362-
363-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367-
368-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
369-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372-
373-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377-
378-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382-
383-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387-
388-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
392-
393-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
396-
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
318+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
322+
323+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327+
328+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332+
333+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
335+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
336+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337+
338+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342+
343+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347+
348+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
350+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352+
353+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
354+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
356+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357+
358+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
359+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
361+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362+
363+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367+
368+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
369+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
372+
373+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377+
378+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382+
383+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387+
388+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
392+
393+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
396+
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397397
};
398398

399399
// Add sets res to the sum a+b
@@ -1212,7 +1212,7 @@ internal static (ulong quo, ulong rem) Div64(ulong hi, ulong lo, ulong y)
12121212

12131213
if (y <= hi)
12141214
{
1215-
ThrowOverflowException();
1215+
ThrowOverflowException("y <= hi");
12161216
}
12171217

12181218
var s = LeadingZeros(y);
@@ -1586,7 +1586,7 @@ public static void Xor(in UInt256 a, in UInt256 b, out UInt256 res)
15861586
{
15871587
if (SubtractUnderflow(in a, in b, out UInt256 c))
15881588
{
1589-
ThrowArithmeticException(in a, in b);
1589+
ThrowOverflowException($"Underflow in subtraction {a} - {b}");
15901590
}
15911591

15921592
return c;
@@ -1611,43 +1611,43 @@ public static explicit operator BigInteger(in UInt256 value)
16111611
}
16121612

16131613
public static explicit operator sbyte(in UInt256 a) =>
1614-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > (long)sbyte.MaxValue
1615-
? throw new OverflowException("Cannot convert UInt256 value to sbyte.")
1614+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > (long)sbyte.MaxValue
1615+
? throw new OverflowException("Cannot convert UInt256 value to sbyte.")
16161616
: (sbyte)a.u0;
16171617

1618-
public static explicit operator byte(in UInt256 a) =>
1619-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > byte.MaxValue
1618+
public static explicit operator byte(in UInt256 a) =>
1619+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > byte.MaxValue
16201620
? throw new OverflowException("Cannot convert UInt256 value to byte.")
16211621
: (byte)a.u0;
16221622

1623-
public static explicit operator short(in UInt256 a) =>
1624-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > (long)short.MaxValue
1625-
? throw new OverflowException("Cannot convert UInt256 value to short.")
1623+
public static explicit operator short(in UInt256 a) =>
1624+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > (long)short.MaxValue
1625+
? throw new OverflowException("Cannot convert UInt256 value to short.")
16261626
: (short)a.u0;
16271627

1628-
public static explicit operator ushort(in UInt256 a) =>
1629-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > ushort.MaxValue
1630-
? throw new OverflowException("Cannot convert UInt256 value to ushort.")
1628+
public static explicit operator ushort(in UInt256 a) =>
1629+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > ushort.MaxValue
1630+
? throw new OverflowException("Cannot convert UInt256 value to ushort.")
16311631
: (ushort)a.u0;
16321632

1633-
public static explicit operator int(in UInt256 a) =>
1634-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > int.MaxValue
1635-
? throw new OverflowException("Cannot convert UInt256 value to int.")
1633+
public static explicit operator int(in UInt256 a) =>
1634+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > int.MaxValue
1635+
? throw new OverflowException("Cannot convert UInt256 value to int.")
16361636
: (int)a.u0;
16371637

1638-
public static explicit operator uint(in UInt256 a) =>
1639-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > uint.MaxValue
1640-
? throw new OverflowException("Cannot convert UInt256 value to uint.")
1638+
public static explicit operator uint(in UInt256 a) =>
1639+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > uint.MaxValue
1640+
? throw new OverflowException("Cannot convert UInt256 value to uint.")
16411641
: (uint)a.u0;
16421642

1643-
public static explicit operator long(in UInt256 a) =>
1644-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > long.MaxValue
1645-
? throw new OverflowException("Cannot convert UInt256 value to long.")
1643+
public static explicit operator long(in UInt256 a) =>
1644+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0 || a.u0 > long.MaxValue
1645+
? throw new OverflowException("Cannot convert UInt256 value to long.")
16461646
: (long)a.u0;
16471647

1648-
public static explicit operator ulong(in UInt256 a) =>
1649-
a.u1 > 0 || a.u2 > 0 || a.u3 > 0
1650-
? throw new OverflowException("Cannot convert UInt256 value to ulong.")
1648+
public static explicit operator ulong(in UInt256 a) =>
1649+
a.u1 > 0 || a.u2 > 0 || a.u3 > 0
1650+
? throw new OverflowException("Cannot convert UInt256 value to ulong.")
16511651
: a.u0;
16521652

16531653
public static UInt256 operator *(in UInt256 a, uint b)
@@ -1774,22 +1774,22 @@ private static bool LessThan(in UInt256 a, in UInt256 b)
17741774
public static bool operator !=(long a, in UInt256 b) => !b.Equals(a);
17751775
public static bool operator !=(in UInt256 a, ulong b) => !a.Equals(b);
17761776
public static bool operator !=(ulong a, in UInt256 b) => !b.Equals(a);
1777-
public static explicit operator UInt256(sbyte a) =>
1777+
public static explicit operator UInt256(sbyte a) =>
17781778
a < 0 ? throw new ArgumentException($"Expected a positive number and got {a}", nameof(a)) : new UInt256((ulong)a);
17791779

17801780
public static implicit operator UInt256(byte a) => new(a);
17811781

1782-
public static explicit operator UInt256(short a) =>
1782+
public static explicit operator UInt256(short a) =>
17831783
a < 0 ? throw new ArgumentException($"Expected a positive number and got {a}", nameof(a)) : new UInt256((ulong)a);
17841784

17851785
public static implicit operator UInt256(ushort a) => new(a);
17861786

1787-
public static explicit operator UInt256(int n) =>
1787+
public static explicit operator UInt256(int n) =>
17881788
n < 0 ? throw new ArgumentException("n < 0") : new UInt256((ulong)n);
17891789

17901790
public static implicit operator UInt256(uint a) => new(a);
17911791

1792-
public static explicit operator UInt256(long a) =>
1792+
public static explicit operator UInt256(long a) =>
17931793
a < 0 ? throw new ArgumentException($"Expected a positive number and got {a}", nameof(a)) : new UInt256((ulong)a);
17941794

17951795
public override string ToString() => ((BigInteger)this).ToString();
@@ -1945,10 +1945,7 @@ public object ToType(Type conversionType, IFormatProvider? provider) =>
19451945
private static void ThrowDivideByZeroException() => throw new DivideByZeroException("y == 0");
19461946

19471947
[DoesNotReturn]
1948-
private static void ThrowArithmeticException(in UInt256 a, in UInt256 b) => throw new ArithmeticException($"Underflow in subtraction {a} - {b}");
1949-
1950-
[DoesNotReturn]
1951-
private static void ThrowOverflowException() => throw new OverflowException("y <= hi");
1948+
private static void ThrowOverflowException(string message) => throw new OverflowException(message);
19521949

19531950
[DoesNotReturn]
19541951
private static void ThrowNotSupportedException() => throw new NotSupportedException();

0 commit comments

Comments
 (0)