Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UInt32.cs
Go to the documentation of this file.
6
7namespace System;
8
10[CLSCompliant(false)]
11[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
12public readonly struct UInt32 : IComparable, IConvertible, ISpanFormattable, IFormattable, IComparable<uint>, IEquatable<uint>, IBinaryInteger<uint>, IBinaryNumber<uint>, IBitwiseOperators<uint, uint, uint>, INumber<uint>, IAdditionOperators<uint, uint, uint>, IAdditiveIdentity<uint, uint>, IComparisonOperators<uint, uint>, IEqualityOperators<uint, uint>, IDecrementOperators<uint>, IDivisionOperators<uint, uint, uint>, IIncrementOperators<uint>, IModulusOperators<uint, uint, uint>, IMultiplicativeIdentity<uint, uint>, IMultiplyOperators<uint, uint, uint>, ISpanParseable<uint>, IParseable<uint>, ISubtractionOperators<uint, uint, uint>, IUnaryNegationOperators<uint, uint>, IUnaryPlusOperators<uint, uint>, IShiftOperators<uint, uint>, IMinMaxValue<uint>, IUnsignedNumber<uint>
13{
14 private readonly uint m_value;
15
16 public const uint MaxValue = 4294967295u;
17
18 public const uint MinValue = 0u;
19
20 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
22
23 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
24 static uint IMinMaxValue<uint>.MinValue => 0u;
25
26 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
27 static uint IMinMaxValue<uint>.MaxValue => uint.MaxValue;
28
29 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
31
32 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
33 static uint INumber<uint>.One => 1u;
34
35 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
36 static uint INumber<uint>.Zero => 0u;
37
38 public int CompareTo(object? value)
39 {
40 if (value == null)
41 {
42 return 1;
43 }
44 if (value is uint num)
45 {
46 if (this < num)
47 {
48 return -1;
49 }
50 if (this > num)
51 {
52 return 1;
53 }
54 return 0;
55 }
57 }
58
59 public int CompareTo(uint value)
60 {
61 if (this < value)
62 {
63 return -1;
64 }
65 if (this > value)
66 {
67 return 1;
68 }
69 return 0;
70 }
71
72 public override bool Equals([NotNullWhen(true)] object? obj)
73 {
74 if (!(obj is uint))
75 {
76 return false;
77 }
78 return this == (uint)obj;
79 }
80
81 [NonVersionable]
82 public bool Equals(uint obj)
83 {
84 return this == obj;
85 }
86
87 public override int GetHashCode()
88 {
89 return (int)this;
90 }
91
92 public override string ToString()
93 {
94 return Number.UInt32ToDecStr(this);
95 }
96
97 public string ToString(IFormatProvider? provider)
98 {
99 return Number.UInt32ToDecStr(this);
100 }
101
102 public string ToString(string? format)
103 {
104 return Number.FormatUInt32(this, format, null);
105 }
106
107 public string ToString(string? format, IFormatProvider? provider)
108 {
109 return Number.FormatUInt32(this, format, provider);
110 }
111
112 public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default(ReadOnlySpan<char>), IFormatProvider? provider = null)
113 {
114 return Number.TryFormatUInt32(this, format, provider, destination, out charsWritten);
115 }
116
117 public static uint Parse(string s)
118 {
119 if (s == null)
120 {
122 }
124 }
125
126 public static uint Parse(string s, NumberStyles style)
127 {
129 if (s == null)
130 {
132 }
134 }
135
136 public static uint Parse(string s, IFormatProvider? provider)
137 {
138 if (s == null)
139 {
141 }
142 return Number.ParseUInt32(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider));
143 }
144
145 public static uint Parse(string s, NumberStyles style, IFormatProvider? provider)
146 {
148 if (s == null)
149 {
151 }
152 return Number.ParseUInt32(s, style, NumberFormatInfo.GetInstance(provider));
153 }
154
155 public static uint Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
156 {
158 return Number.ParseUInt32(s, style, NumberFormatInfo.GetInstance(provider));
159 }
160
161 public static bool TryParse([NotNullWhen(true)] string? s, out uint result)
162 {
163 if (s == null)
164 {
165 result = 0u;
166 return false;
167 }
169 }
170
171 public static bool TryParse(ReadOnlySpan<char> s, out uint result)
172 {
174 }
175
176 public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out uint result)
177 {
179 if (s == null)
180 {
181 result = 0u;
182 return false;
183 }
184 return Number.TryParseUInt32(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
185 }
186
187 public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out uint result)
188 {
190 return Number.TryParseUInt32(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
191 }
192
194 {
195 return TypeCode.UInt32;
196 }
197
199 {
200 return Convert.ToBoolean(this);
201 }
202
204 {
205 return Convert.ToChar(this);
206 }
207
209 {
210 return Convert.ToSByte(this);
211 }
212
214 {
215 return Convert.ToByte(this);
216 }
217
219 {
220 return Convert.ToInt16(this);
221 }
222
224 {
225 return Convert.ToUInt16(this);
226 }
227
229 {
230 return Convert.ToInt32(this);
231 }
232
234 {
235 return this;
236 }
237
239 {
240 return Convert.ToInt64(this);
241 }
242
244 {
245 return Convert.ToUInt64(this);
246 }
247
249 {
250 return Convert.ToSingle(this);
251 }
252
254 {
255 return Convert.ToDouble(this);
256 }
257
259 {
260 return Convert.ToDecimal(this);
261 }
262
264 {
265 throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "UInt32", "DateTime"));
266 }
267
269 {
270 return Convert.DefaultToType(this, type, provider);
271 }
272
273 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
274 static uint IAdditionOperators<uint, uint, uint>.operator +(uint left, uint right)
275 {
276 return left + right;
277 }
278
279 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
281 {
283 }
284
285 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
287 {
288 return (uint)BitOperations.PopCount(value);
289 }
290
291 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
292 static uint IBinaryInteger<uint>.RotateLeft(uint value, int rotateAmount)
293 {
294 return BitOperations.RotateLeft(value, rotateAmount);
295 }
296
297 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
298 static uint IBinaryInteger<uint>.RotateRight(uint value, int rotateAmount)
299 {
300 return BitOperations.RotateRight(value, rotateAmount);
301 }
302
303 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
305 {
307 }
308
309 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
311 {
312 return BitOperations.IsPow2(value);
313 }
314
315 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
317 {
318 return (uint)BitOperations.Log2(value);
319 }
320
321 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
322 static uint IBitwiseOperators<uint, uint, uint>.operator &(uint left, uint right)
323 {
324 return left & right;
325 }
326
327 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
328 static uint IBitwiseOperators<uint, uint, uint>.operator |(uint left, uint right)
329 {
330 return left | right;
331 }
332
333 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
334 static uint IBitwiseOperators<uint, uint, uint>.operator ^(uint left, uint right)
335 {
336 return left ^ right;
337 }
338
339 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
340 static uint IBitwiseOperators<uint, uint, uint>.operator ~(uint value)
341 {
342 return ~value;
343 }
344
345 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
346 static bool IComparisonOperators<uint, uint>.operator <(uint left, uint right)
347 {
348 return left < right;
349 }
350
351 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
352 static bool IComparisonOperators<uint, uint>.operator <=(uint left, uint right)
353 {
354 return left <= right;
355 }
356
357 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
358 static bool IComparisonOperators<uint, uint>.operator >(uint left, uint right)
359 {
360 return left > right;
361 }
362
363 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
364 static bool IComparisonOperators<uint, uint>.operator >=(uint left, uint right)
365 {
366 return left >= right;
367 }
368
369 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
370 static uint IDecrementOperators<uint>.operator --(uint value)
371 {
372 return --value;
373 }
374
375 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
376 static uint IDivisionOperators<uint, uint, uint>.operator /(uint left, uint right)
377 {
378 return left / right;
379 }
380
381 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
382 static bool IEqualityOperators<uint, uint>.operator ==(uint left, uint right)
383 {
384 return left == right;
385 }
386
387 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
388 static bool IEqualityOperators<uint, uint>.operator !=(uint left, uint right)
389 {
390 return left != right;
391 }
392
393 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
394 static uint IIncrementOperators<uint>.operator ++(uint value)
395 {
396 return ++value;
397 }
398
399 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
400 static uint IModulusOperators<uint, uint, uint>.operator %(uint left, uint right)
401 {
402 return left % right;
403 }
404
405 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
406 static uint IMultiplyOperators<uint, uint, uint>.operator *(uint left, uint right)
407 {
408 return left * right;
409 }
410
411 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
412 static uint INumber<uint>.Abs(uint value)
413 {
414 return value;
415 }
416
417 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
418 static uint INumber<uint>.Clamp(uint value, uint min, uint max)
419 {
420 return Math.Clamp(value, min, max);
421 }
422
423 [MethodImpl(MethodImplOptions.AggressiveInlining)]
424 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
425 static uint INumber<uint>.Create<TOther>(TOther value)
426 {
427 if (typeof(TOther) == typeof(byte))
428 {
429 return (byte)(object)value;
430 }
431 if (typeof(TOther) == typeof(char))
432 {
433 return (char)(object)value;
434 }
435 if (typeof(TOther) == typeof(decimal))
436 {
437 return (uint)(decimal)(object)value;
438 }
439 checked
440 {
441 if (typeof(TOther) == typeof(double))
442 {
443 return (uint)(double)(object)value;
444 }
445 if (typeof(TOther) == typeof(short))
446 {
447 return (uint)(short)(object)value;
448 }
449 if (typeof(TOther) == typeof(int))
450 {
451 return (uint)(int)(object)value;
452 }
453 if (typeof(TOther) == typeof(long))
454 {
455 return (uint)(long)(object)value;
456 }
457 if (typeof(TOther) == typeof(IntPtr))
458 {
459 return (uint)(nint)(IntPtr)(object)value;
460 }
461 if (typeof(TOther) == typeof(sbyte))
462 {
463 return (uint)(sbyte)(object)value;
464 }
465 if (typeof(TOther) == typeof(float))
466 {
467 return (uint)(float)(object)value;
468 }
469 if (typeof(TOther) == typeof(ushort))
470 {
471 return (ushort)(object)value;
472 }
473 if (typeof(TOther) == typeof(uint))
474 {
475 return (uint)(object)value;
476 }
477 if (typeof(TOther) == typeof(ulong))
478 {
479 return (uint)(ulong)(object)value;
480 }
481 if (typeof(TOther) == typeof(UIntPtr))
482 {
483 return (uint)(UIntPtr)(object)value;
484 }
486 return 0u;
487 }
488 }
489
490 [MethodImpl(MethodImplOptions.AggressiveInlining)]
491 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
492 static uint INumber<uint>.CreateSaturating<TOther>(TOther value)
493 {
494 if (typeof(TOther) == typeof(byte))
495 {
496 return (byte)(object)value;
497 }
498 if (typeof(TOther) == typeof(char))
499 {
500 return (char)(object)value;
501 }
502 if (typeof(TOther) == typeof(decimal))
503 {
504 decimal num = (decimal)(object)value;
505 if (!(num > 4294967295m))
506 {
507 if (!(num < 0m))
508 {
509 return (uint)num;
510 }
511 return 0u;
512 }
513 return uint.MaxValue;
514 }
515 if (typeof(TOther) == typeof(double))
516 {
517 double num2 = (double)(object)value;
518 if (!(num2 > 4294967295.0))
519 {
520 if (!(num2 < 0.0))
521 {
522 return (uint)num2;
523 }
524 return 0u;
525 }
526 return uint.MaxValue;
527 }
528 if (typeof(TOther) == typeof(short))
529 {
530 short num3 = (short)(object)value;
531 if (num3 >= 0)
532 {
533 return (uint)num3;
534 }
535 return 0u;
536 }
537 if (typeof(TOther) == typeof(int))
538 {
539 int num4 = (int)(object)value;
540 if (num4 >= 0)
541 {
542 return (uint)num4;
543 }
544 return 0u;
545 }
546 if (typeof(TOther) == typeof(long))
547 {
548 long num5 = (long)(object)value;
549 if (num5 <= uint.MaxValue)
550 {
551 if (num5 >= 0)
552 {
553 return (uint)num5;
554 }
555 return 0u;
556 }
557 return uint.MaxValue;
558 }
559 if (typeof(TOther) == typeof(IntPtr))
560 {
561 IntPtr intPtr = (IntPtr)(object)value;
562 if ((nint)intPtr <= uint.MaxValue)
563 {
564 if ((nint)intPtr >= 0)
565 {
566 return (uint)(nint)intPtr;
567 }
568 return 0u;
569 }
570 return uint.MaxValue;
571 }
572 if (typeof(TOther) == typeof(sbyte))
573 {
574 sbyte b = (sbyte)(object)value;
575 if (b >= 0)
576 {
577 return (uint)b;
578 }
579 return 0u;
580 }
581 if (typeof(TOther) == typeof(float))
582 {
583 float num6 = (float)(object)value;
584 if (!(num6 > 4.2949673E+09f))
585 {
586 if (!(num6 < 0f))
587 {
588 return (uint)num6;
589 }
590 return 0u;
591 }
592 return uint.MaxValue;
593 }
594 if (typeof(TOther) == typeof(ushort))
595 {
596 return (ushort)(object)value;
597 }
598 if (typeof(TOther) == typeof(uint))
599 {
600 return (uint)(object)value;
601 }
602 if (typeof(TOther) == typeof(ulong))
603 {
604 ulong num7 = (ulong)(object)value;
605 if (num7 <= uint.MaxValue)
606 {
607 return (uint)num7;
608 }
609 return uint.MaxValue;
610 }
611 if (typeof(TOther) == typeof(UIntPtr))
612 {
613 UIntPtr uIntPtr = (UIntPtr)(object)value;
614 if ((nuint)uIntPtr <= uint.MaxValue)
615 {
616 return (uint)(nuint)uIntPtr;
617 }
618 return uint.MaxValue;
619 }
621 return 0u;
622 }
623
624 [MethodImpl(MethodImplOptions.AggressiveInlining)]
625 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
626 static uint INumber<uint>.CreateTruncating<TOther>(TOther value)
627 {
628 if (typeof(TOther) == typeof(byte))
629 {
630 return (byte)(object)value;
631 }
632 if (typeof(TOther) == typeof(char))
633 {
634 return (char)(object)value;
635 }
636 if (typeof(TOther) == typeof(decimal))
637 {
638 return (uint)(decimal)(object)value;
639 }
640 if (typeof(TOther) == typeof(double))
641 {
642 return (uint)(double)(object)value;
643 }
644 if (typeof(TOther) == typeof(short))
645 {
646 return (uint)(short)(object)value;
647 }
648 if (typeof(TOther) == typeof(int))
649 {
650 return (uint)(int)(object)value;
651 }
652 if (typeof(TOther) == typeof(long))
653 {
654 return (uint)(long)(object)value;
655 }
656 if (typeof(TOther) == typeof(IntPtr))
657 {
658 return (uint)(nint)(IntPtr)(object)value;
659 }
660 if (typeof(TOther) == typeof(sbyte))
661 {
662 return (uint)(sbyte)(object)value;
663 }
664 if (typeof(TOther) == typeof(float))
665 {
666 return (uint)(float)(object)value;
667 }
668 if (typeof(TOther) == typeof(ushort))
669 {
670 return (ushort)(object)value;
671 }
672 if (typeof(TOther) == typeof(uint))
673 {
674 return (uint)(object)value;
675 }
676 if (typeof(TOther) == typeof(ulong))
677 {
678 return (uint)(ulong)(object)value;
679 }
680 if (typeof(TOther) == typeof(UIntPtr))
681 {
682 return (uint)(nuint)(UIntPtr)(object)value;
683 }
685 return 0u;
686 }
687
688 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
689 static (uint Quotient, uint Remainder) INumber<uint>.DivRem(uint left, uint right)
690 {
691 return Math.DivRem(left, right);
692 }
693
694 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
695 static uint INumber<uint>.Max(uint x, uint y)
696 {
697 return Math.Max(x, y);
698 }
699
700 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
701 static uint INumber<uint>.Min(uint x, uint y)
702 {
703 return Math.Min(x, y);
704 }
705
706 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
707 static uint INumber<uint>.Parse(string s, NumberStyles style, IFormatProvider provider)
708 {
709 return Parse(s, style, provider);
710 }
711
712 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
714 {
715 return Parse(s, style, provider);
716 }
717
718 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
719 static uint INumber<uint>.Sign(uint value)
720 {
721 if (value != 0)
722 {
723 return 1u;
724 }
725 return 0u;
726 }
727
728 [MethodImpl(MethodImplOptions.AggressiveInlining)]
729 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
730 static bool INumber<uint>.TryCreate<TOther>(TOther value, out uint result)
731 {
732 if (typeof(TOther) == typeof(byte))
733 {
734 result = (byte)(object)value;
735 return true;
736 }
737 if (typeof(TOther) == typeof(char))
738 {
739 result = (char)(object)value;
740 return true;
741 }
742 if (typeof(TOther) == typeof(decimal))
743 {
744 decimal num = (decimal)(object)value;
745 if (num < 0m || num > 4294967295m)
746 {
747 result = 0u;
748 return false;
749 }
750 result = (uint)num;
751 return true;
752 }
753 if (typeof(TOther) == typeof(double))
754 {
755 double num2 = (double)(object)value;
756 if (num2 < 0.0 || num2 > 4294967295.0)
757 {
758 result = 0u;
759 return false;
760 }
761 result = (uint)num2;
762 return true;
763 }
764 if (typeof(TOther) == typeof(short))
765 {
766 short num3 = (short)(object)value;
767 if (num3 < 0)
768 {
769 result = 0u;
770 return false;
771 }
772 result = (uint)num3;
773 return true;
774 }
775 if (typeof(TOther) == typeof(int))
776 {
777 int num4 = (int)(object)value;
778 if (num4 < 0)
779 {
780 result = 0u;
781 return false;
782 }
783 result = (uint)num4;
784 return true;
785 }
786 if (typeof(TOther) == typeof(long))
787 {
788 long num5 = (long)(object)value;
789 if (num5 < 0 || num5 > uint.MaxValue)
790 {
791 result = 0u;
792 return false;
793 }
794 result = (uint)num5;
795 return true;
796 }
797 if (typeof(TOther) == typeof(IntPtr))
798 {
799 IntPtr intPtr = (IntPtr)(object)value;
800 if ((nint)intPtr < 0 || (nint)intPtr > uint.MaxValue)
801 {
802 result = 0u;
803 return false;
804 }
805 result = (uint)(nint)intPtr;
806 return true;
807 }
808 if (typeof(TOther) == typeof(sbyte))
809 {
810 sbyte b = (sbyte)(object)value;
811 if (b < 0)
812 {
813 result = 0u;
814 return false;
815 }
816 result = (uint)b;
817 return true;
818 }
819 if (typeof(TOther) == typeof(float))
820 {
821 float num6 = (float)(object)value;
822 if (num6 < 0f || num6 > 4.2949673E+09f)
823 {
824 result = 0u;
825 return false;
826 }
827 result = (uint)num6;
828 return true;
829 }
830 if (typeof(TOther) == typeof(ushort))
831 {
832 result = (ushort)(object)value;
833 return true;
834 }
835 if (typeof(TOther) == typeof(uint))
836 {
837 result = (uint)(object)value;
838 return true;
839 }
840 if (typeof(TOther) == typeof(ulong))
841 {
842 ulong num7 = (ulong)(object)value;
843 if (num7 > uint.MaxValue)
844 {
845 result = 0u;
846 return false;
847 }
848 result = (uint)num7;
849 return true;
850 }
851 if (typeof(TOther) == typeof(UIntPtr))
852 {
853 UIntPtr uIntPtr = (UIntPtr)(object)value;
854 if ((nuint)uIntPtr > uint.MaxValue)
855 {
856 result = 0u;
857 return false;
858 }
859 result = (uint)(nuint)uIntPtr;
860 return true;
861 }
863 result = 0u;
864 return false;
865 }
866
867 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
868 static bool INumber<uint>.TryParse([NotNullWhen(true)] string s, NumberStyles style, IFormatProvider provider, out uint result)
869 {
870 return TryParse(s, style, provider, out result);
871 }
872
873 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
874 static bool INumber<uint>.TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out uint result)
875 {
876 return TryParse(s, style, provider, out result);
877 }
878
879 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
880 static uint IParseable<uint>.Parse(string s, IFormatProvider provider)
881 {
882 return Parse(s, provider);
883 }
884
885 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
886 static bool IParseable<uint>.TryParse([NotNullWhen(true)] string s, IFormatProvider provider, out uint result)
887 {
888 return TryParse(s, NumberStyles.Integer, provider, out result);
889 }
890
891 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
892 static uint IShiftOperators<uint, uint>.operator <<(uint value, int shiftAmount)
893 {
894 return value << shiftAmount;
895 }
896
897 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
898 static uint IShiftOperators<uint, uint>.operator >>(uint value, int shiftAmount)
899 {
900 return value >> shiftAmount;
901 }
902
903 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
905 {
906 return Parse(s, NumberStyles.Integer, provider);
907 }
908
909 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
910 static bool ISpanParseable<uint>.TryParse(ReadOnlySpan<char> s, IFormatProvider provider, out uint result)
911 {
912 return TryParse(s, NumberStyles.Integer, provider, out result);
913 }
914
915 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
916 static uint ISubtractionOperators<uint, uint, uint>.operator -(uint left, uint right)
917 {
918 return left - right;
919 }
920
921 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
922 static uint IUnaryNegationOperators<uint, uint>.operator -(uint value)
923 {
924 return 0 - value;
925 }
926
927 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
928 static uint IUnaryPlusOperators<uint, uint>.operator +(uint value)
929 {
930 return value;
931 }
932}
static decimal ToDecimal(object? value)
Definition Convert.cs:2101
static long ToInt64(object? value)
Definition Convert.cs:1623
static float ToSingle(object? value)
Definition Convert.cs:1881
static int ToInt32(object? value)
Definition Convert.cs:1320
static short ToInt16(object? value)
Definition Convert.cs:1038
static byte ToByte(object? value)
Definition Convert.cs:900
static ulong ToUInt64(object? value)
Definition Convert.cs:1738
static char ToChar(object? value)
Definition Convert.cs:618
static ushort ToUInt16(object? value)
Definition Convert.cs:1177
static sbyte ToSByte(object? value)
Definition Convert.cs:745
static double ToDouble(object? value)
Definition Convert.cs:1991
static bool ToBoolean([NotNullWhen(true)] object? value)
Definition Convert.cs:508
static object DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
Definition Convert.cs:269
static void ValidateParseStyleInteger(NumberStyles style)
static NumberFormatInfo GetInstance(IFormatProvider? formatProvider)
static byte Clamp(byte value, byte min, byte max)
Definition Math.cs:435
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static int DivRem(int a, int b, out int result)
Definition Math.cs:329
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static ParsingStatus TryParseUInt32IntegerStyle(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out uint result)
Definition Number.cs:4764
static string FormatUInt32(uint value, string format, IFormatProvider provider)
Definition Number.cs:1975
static uint ParseUInt32(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info)
Definition Number.cs:4019
static bool TryFormatUInt32(uint value, ReadOnlySpan< char > format, IFormatProvider provider, Span< char > destination, out int charsWritten)
Definition Number.cs:2014
static ParsingStatus TryParseUInt32(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out uint result)
Definition Number.cs:4735
static unsafe string UInt32ToDecStr(uint value)
Definition Number.cs:2382
static int TrailingZeroCount(int value)
static bool IsPow2(int value)
static int PopCount(uint value)
static int Log2(uint value)
static uint RotateRight(uint value, int offset)
static int LeadingZeroCount(uint value)
static uint RotateLeft(uint value, int offset)
static string Arg_MustBeUInt32
Definition SR.cs:308
static string InvalidCast_FromTo
Definition SR.cs:1392
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7
static void ThrowNotSupportedException(ExceptionResource resource)
static void ThrowArgumentNullException(string name)
static TResult AdditiveIdentity
static TSelf RotateRight(TSelf value, int rotateAmount)
static TSelf LeadingZeroCount(TSelf value)
static TSelf PopCount(TSelf value)
static TSelf TrailingZeroCount(TSelf value)
static TSelf RotateLeft(TSelf value, int rotateAmount)
static bool IsPow2(TSelf value)
static TSelf Log2(TSelf value)
short ToInt16(IFormatProvider? provider)
char ToChar(IFormatProvider? provider)
byte ToByte(IFormatProvider? provider)
decimal ToDecimal(IFormatProvider? provider)
object ToType(Type conversionType, IFormatProvider? provider)
uint ToUInt32(IFormatProvider? provider)
DateTime ToDateTime(IFormatProvider? provider)
int ToInt32(IFormatProvider? provider)
long ToInt64(IFormatProvider? provider)
ushort ToUInt16(IFormatProvider? provider)
double ToDouble(IFormatProvider? provider)
float ToSingle(IFormatProvider? provider)
sbyte ToSByte(IFormatProvider? provider)
ulong ToUInt64(IFormatProvider? provider)
bool ToBoolean(IFormatProvider? provider)
static TSelf MinValue
static TSelf MaxValue
static TSelf Max(TSelf x, TSelf y)
static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out TSelf result)
static TSelf Parse(string s, NumberStyles style, IFormatProvider? provider)
static TSelf Sign(TSelf value)
static TSelf Min(TSelf x, TSelf y)
static TSelf One
Definition INumber.cs:10
static TSelf Zero
Definition INumber.cs:12
static TSelf Abs(TSelf value)
static TSelf Clamp(TSelf value, TSelf min, TSelf max)
static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(string s, IFormatProvider? provider)
static bool TryParse(ReadOnlySpan< char > s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(ReadOnlySpan< char > s, IFormatProvider? provider)
TypeCode
Definition TypeCode.cs:4
static IntPtr MaxValue
Definition IntPtr.cs:30
readonly uint m_value
Definition UInt32.cs:14
const uint MaxValue
Definition UInt32.cs:16
static uint Parse(string s, NumberStyles style)
Definition UInt32.cs:126
string ToString(IFormatProvider? provider)
Definition UInt32.cs:97
static uint Parse(string s, NumberStyles style, IFormatProvider? provider)
Definition UInt32.cs:145
static bool TryParse(ReadOnlySpan< char > s, out uint result)
Definition UInt32.cs:171
override bool Equals([NotNullWhen(true)] object? obj)
Definition UInt32.cs:72
override int GetHashCode()
Definition UInt32.cs:87
static uint Parse(string s)
Definition UInt32.cs:117
int CompareTo(object? value)
Definition UInt32.cs:38
static bool TryParse([NotNullWhen(true)] string? s, out uint result)
Definition UInt32.cs:161
override string ToString()
Definition UInt32.cs:92
static uint uint Remainder INumber< uint >. DivRem(uint left, uint right)
Definition UInt32.cs:689
static bool TryParse(ReadOnlySpan< char > s, NumberStyles style, IFormatProvider? provider, out uint result)
Definition UInt32.cs:187
bool TryFormat(Span< char > destination, out int charsWritten, ReadOnlySpan< char > format=default(ReadOnlySpan< char >), IFormatProvider? provider=null)
Definition UInt32.cs:112
string ToString(string? format)
Definition UInt32.cs:102
static uint Parse(string s, IFormatProvider? provider)
Definition UInt32.cs:136
const uint MinValue
Definition UInt32.cs:18
int CompareTo(uint value)
Definition UInt32.cs:59
static uint Quotient
Definition UInt32.cs:689
TypeCode GetTypeCode()
Definition UInt32.cs:193
static uint Parse(ReadOnlySpan< char > s, NumberStyles style=NumberStyles.Integer, IFormatProvider? provider=null)
Definition UInt32.cs:155
bool Equals(uint obj)
Definition UInt32.cs:82
string ToString(string? format, IFormatProvider? provider)
Definition UInt32.cs:107
static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out uint result)
Definition UInt32.cs:176
static UIntPtr MaxValue
Definition UIntPtr.cs:31