@@ -309,91 +309,91 @@ public bool IsOne
309
309
public bool IsZeroOrOne => ( ( u0 >> 1 ) | u1 | u2 | u3 ) == 0 ;
310
310
311
311
public UInt256 ZeroValue => Zero ;
312
-
312
+
313
313
public UInt256 OneValue => One ;
314
314
315
315
public UInt256 MaximalValue => MaxValue ;
316
316
317
317
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 ,
397
397
} ;
398
398
399
399
// 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)
1212
1212
1213
1213
if ( y <= hi )
1214
1214
{
1215
- ThrowOverflowException ( ) ;
1215
+ ThrowOverflowException ( "y <= hi" ) ;
1216
1216
}
1217
1217
1218
1218
var s = LeadingZeros ( y ) ;
@@ -1586,7 +1586,7 @@ public static void Xor(in UInt256 a, in UInt256 b, out UInt256 res)
1586
1586
{
1587
1587
if ( SubtractUnderflow ( in a , in b , out UInt256 c ) )
1588
1588
{
1589
- ThrowArithmeticException ( in a , in b ) ;
1589
+ ThrowOverflowException ( $ "Underflow in subtraction { a } - { b } " ) ;
1590
1590
}
1591
1591
1592
1592
return c ;
@@ -1611,43 +1611,43 @@ public static explicit operator BigInteger(in UInt256 value)
1611
1611
}
1612
1612
1613
1613
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." )
1616
1616
: ( sbyte ) a . u0 ;
1617
1617
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
1620
1620
? throw new OverflowException ( "Cannot convert UInt256 value to byte." )
1621
1621
: ( byte ) a . u0 ;
1622
1622
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." )
1626
1626
: ( short ) a . u0 ;
1627
1627
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." )
1631
1631
: ( ushort ) a . u0 ;
1632
1632
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." )
1636
1636
: ( int ) a . u0 ;
1637
1637
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." )
1641
1641
: ( uint ) a . u0 ;
1642
1642
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." )
1646
1646
: ( long ) a . u0 ;
1647
1647
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." )
1651
1651
: a . u0 ;
1652
1652
1653
1653
public static UInt256 operator * ( in UInt256 a , uint b )
@@ -1774,22 +1774,22 @@ private static bool LessThan(in UInt256 a, in UInt256 b)
1774
1774
public static bool operator != ( long a , in UInt256 b ) => ! b . Equals ( a ) ;
1775
1775
public static bool operator != ( in UInt256 a , ulong b ) => ! a . Equals ( b ) ;
1776
1776
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 ) =>
1778
1778
a < 0 ? throw new ArgumentException ( $ "Expected a positive number and got { a } ", nameof ( a ) ) : new UInt256 ( ( ulong ) a ) ;
1779
1779
1780
1780
public static implicit operator UInt256 ( byte a ) => new ( a ) ;
1781
1781
1782
- public static explicit operator UInt256 ( short a ) =>
1782
+ public static explicit operator UInt256 ( short a ) =>
1783
1783
a < 0 ? throw new ArgumentException ( $ "Expected a positive number and got { a } ", nameof ( a ) ) : new UInt256 ( ( ulong ) a ) ;
1784
1784
1785
1785
public static implicit operator UInt256 ( ushort a ) => new ( a ) ;
1786
1786
1787
- public static explicit operator UInt256 ( int n ) =>
1787
+ public static explicit operator UInt256 ( int n ) =>
1788
1788
n < 0 ? throw new ArgumentException ( "n < 0" ) : new UInt256 ( ( ulong ) n ) ;
1789
1789
1790
1790
public static implicit operator UInt256 ( uint a ) => new ( a ) ;
1791
1791
1792
- public static explicit operator UInt256 ( long a ) =>
1792
+ public static explicit operator UInt256 ( long a ) =>
1793
1793
a < 0 ? throw new ArgumentException ( $ "Expected a positive number and got { a } ", nameof ( a ) ) : new UInt256 ( ( ulong ) a ) ;
1794
1794
1795
1795
public override string ToString ( ) => ( ( BigInteger ) this ) . ToString ( ) ;
@@ -1945,10 +1945,7 @@ public object ToType(Type conversionType, IFormatProvider? provider) =>
1945
1945
private static void ThrowDivideByZeroException ( ) => throw new DivideByZeroException ( "y == 0" ) ;
1946
1946
1947
1947
[ 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 ) ;
1952
1949
1953
1950
[ DoesNotReturn ]
1954
1951
private static void ThrowNotSupportedException ( ) => throw new NotSupportedException ( ) ;
0 commit comments