Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Int64.cs
Go to the documentation of this file.
6
7namespace System;
8
10[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
11public readonly struct Int64 : IComparable, IConvertible, ISpanFormattable, IFormattable, IComparable<long>, IEquatable<long>, IBinaryInteger<long>, IBinaryNumber<long>, IBitwiseOperators<long, long, long>, INumber<long>, IAdditionOperators<long, long, long>, IAdditiveIdentity<long, long>, IComparisonOperators<long, long>, IEqualityOperators<long, long>, IDecrementOperators<long>, IDivisionOperators<long, long, long>, IIncrementOperators<long>, IModulusOperators<long, long, long>, IMultiplicativeIdentity<long, long>, IMultiplyOperators<long, long, long>, ISpanParseable<long>, IParseable<long>, ISubtractionOperators<long, long, long>, IUnaryNegationOperators<long, long>, IUnaryPlusOperators<long, long>, IShiftOperators<long, long>, IMinMaxValue<long>, ISignedNumber<long>
12{
13 private readonly long m_value;
14
15 public const long MaxValue = 9223372036854775807L;
16
17 public const long MinValue = -9223372036854775808L;
18
19 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
21
22 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
23 static long IMinMaxValue<long>.MinValue => long.MinValue;
24
25 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
26 static long IMinMaxValue<long>.MaxValue => long.MaxValue;
27
28 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
30
31 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
32 static long INumber<long>.One => 1L;
33
34 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
35 static long INumber<long>.Zero => 0L;
36
37 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
39
40 public int CompareTo(object? value)
41 {
42 if (value == null)
43 {
44 return 1;
45 }
46 if (value is long num)
47 {
48 if (this < num)
49 {
50 return -1;
51 }
52 if (this > num)
53 {
54 return 1;
55 }
56 return 0;
57 }
59 }
60
61 public int CompareTo(long value)
62 {
63 if (this < value)
64 {
65 return -1;
66 }
67 if (this > value)
68 {
69 return 1;
70 }
71 return 0;
72 }
73
74 public override bool Equals([NotNullWhen(true)] object? obj)
75 {
76 if (!(obj is long))
77 {
78 return false;
79 }
80 return this == (long)obj;
81 }
82
83 [NonVersionable]
84 public bool Equals(long obj)
85 {
86 return this == obj;
87 }
88
89 public override int GetHashCode()
90 {
91 return (int)this ^ (int)(this >> 32);
92 }
93
94 public override string ToString()
95 {
96 return Number.Int64ToDecStr(this);
97 }
98
99 public string ToString(IFormatProvider? provider)
100 {
101 return Number.FormatInt64(this, null, provider);
102 }
103
104 public string ToString(string? format)
105 {
106 return Number.FormatInt64(this, format, null);
107 }
108
109 public string ToString(string? format, IFormatProvider? provider)
110 {
111 return Number.FormatInt64(this, format, provider);
112 }
113
114 public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default(ReadOnlySpan<char>), IFormatProvider? provider = null)
115 {
116 return Number.TryFormatInt64(this, format, provider, destination, out charsWritten);
117 }
118
119 public static long Parse(string s)
120 {
121 if (s == null)
122 {
124 }
126 }
127
128 public static long Parse(string s, NumberStyles style)
129 {
131 if (s == null)
132 {
134 }
136 }
137
138 public static long Parse(string s, IFormatProvider? provider)
139 {
140 if (s == null)
141 {
143 }
144 return Number.ParseInt64(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider));
145 }
146
147 public static long Parse(string s, NumberStyles style, IFormatProvider? provider)
148 {
150 if (s == null)
151 {
153 }
154 return Number.ParseInt64(s, style, NumberFormatInfo.GetInstance(provider));
155 }
156
157 public static long Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
158 {
160 return Number.ParseInt64(s, style, NumberFormatInfo.GetInstance(provider));
161 }
162
163 public static bool TryParse([NotNullWhen(true)] string? s, out long result)
164 {
165 if (s == null)
166 {
167 result = 0L;
168 return false;
169 }
171 }
172
173 public static bool TryParse(ReadOnlySpan<char> s, out long result)
174 {
176 }
177
178 public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out long result)
179 {
181 if (s == null)
182 {
183 result = 0L;
184 return false;
185 }
186 return Number.TryParseInt64(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
187 }
188
189 public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out long result)
190 {
192 return Number.TryParseInt64(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
193 }
194
196 {
197 return TypeCode.Int64;
198 }
199
201 {
202 return Convert.ToBoolean(this);
203 }
204
206 {
207 return Convert.ToChar(this);
208 }
209
211 {
212 return Convert.ToSByte(this);
213 }
214
216 {
217 return Convert.ToByte(this);
218 }
219
221 {
222 return Convert.ToInt16(this);
223 }
224
226 {
227 return Convert.ToUInt16(this);
228 }
229
231 {
232 return Convert.ToInt32(this);
233 }
234
236 {
237 return Convert.ToUInt32(this);
238 }
239
241 {
242 return this;
243 }
244
246 {
247 return Convert.ToUInt64(this);
248 }
249
251 {
252 return Convert.ToSingle(this);
253 }
254
256 {
257 return Convert.ToDouble(this);
258 }
259
261 {
262 return Convert.ToDecimal(this);
263 }
264
266 {
267 throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int64", "DateTime"));
268 }
269
271 {
272 return Convert.DefaultToType(this, type, provider);
273 }
274
275 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
276 static long IAdditionOperators<long, long, long>.operator +(long left, long right)
277 {
278 return left + right;
279 }
280
281 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
283 {
284 return BitOperations.LeadingZeroCount((ulong)value);
285 }
286
287 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
289 {
290 return BitOperations.PopCount((ulong)value);
291 }
292
293 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
294 static long IBinaryInteger<long>.RotateLeft(long value, int rotateAmount)
295 {
296 return (long)BitOperations.RotateLeft((ulong)value, rotateAmount);
297 }
298
299 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
300 static long IBinaryInteger<long>.RotateRight(long value, int rotateAmount)
301 {
302 return (long)BitOperations.RotateRight((ulong)value, rotateAmount);
303 }
304
305 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
310
311 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
313 {
314 return BitOperations.IsPow2(value);
315 }
316
317 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
319 {
320 if (value < 0)
321 {
323 }
324 return BitOperations.Log2((ulong)value);
325 }
326
327 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
328 static long IBitwiseOperators<long, long, long>.operator &(long left, long 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 long IBitwiseOperators<long, long, long>.operator |(long left, long 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 long IBitwiseOperators<long, long, long>.operator ^(long left, long right)
341 {
342 return left ^ right;
343 }
344
345 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
346 static long IBitwiseOperators<long, long, long>.operator ~(long value)
347 {
348 return ~value;
349 }
350
351 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
352 static bool IComparisonOperators<long, long>.operator <(long left, long 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<long, long>.operator <=(long left, long 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<long, long>.operator >(long left, long 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 bool IComparisonOperators<long, long>.operator >=(long left, long right)
371 {
372 return left >= right;
373 }
374
375 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
376 static long IDecrementOperators<long>.operator --(long value)
377 {
378 return --value;
379 }
380
381 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
382 static long IDivisionOperators<long, long, long>.operator /(long left, long 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<long, long>.operator ==(long left, long 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 bool IEqualityOperators<long, long>.operator !=(long left, long right)
395 {
396 return left != right;
397 }
398
399 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
400 static long IIncrementOperators<long>.operator ++(long value)
401 {
402 return ++value;
403 }
404
405 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
406 static long IModulusOperators<long, long, long>.operator %(long left, long 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 long IMultiplyOperators<long, long, long>.operator *(long left, long right)
413 {
414 return left * right;
415 }
416
417 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
418 static long INumber<long>.Abs(long value)
419 {
420 return Math.Abs(value);
421 }
422
423 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
424 static long INumber<long>.Clamp(long value, long min, long max)
425 {
426 return Math.Clamp(value, min, max);
427 }
428
429 [MethodImpl(MethodImplOptions.AggressiveInlining)]
430 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
431 static long INumber<long>.Create<TOther>(TOther value)
432 {
433 if (typeof(TOther) == typeof(byte))
434 {
435 return (byte)(object)value;
436 }
437 if (typeof(TOther) == typeof(char))
438 {
439 return (char)(object)value;
440 }
441 if (typeof(TOther) == typeof(decimal))
442 {
443 return (long)(decimal)(object)value;
444 }
445 if (typeof(TOther) == typeof(double))
446 {
447 return checked((long)(double)(object)value);
448 }
449 if (typeof(TOther) == typeof(short))
450 {
451 return (short)(object)value;
452 }
453 if (typeof(TOther) == typeof(int))
454 {
455 return (int)(object)value;
456 }
457 if (typeof(TOther) == typeof(long))
458 {
459 return (long)(object)value;
460 }
461 if (typeof(TOther) == typeof(IntPtr))
462 {
463 return (long)(IntPtr)(object)value;
464 }
465 if (typeof(TOther) == typeof(sbyte))
466 {
467 return (sbyte)(object)value;
468 }
469 checked
470 {
471 if (typeof(TOther) == typeof(float))
472 {
473 return (long)(float)(object)value;
474 }
475 if (typeof(TOther) == typeof(ushort))
476 {
477 return (ushort)(object)value;
478 }
479 if (typeof(TOther) == typeof(uint))
480 {
481 return (uint)(object)value;
482 }
483 if (typeof(TOther) == typeof(ulong))
484 {
485 return (long)(ulong)(object)value;
486 }
487 if (typeof(TOther) == typeof(UIntPtr))
488 {
489 return (long)(nuint)(UIntPtr)(object)value;
490 }
492 return 0L;
493 }
494 }
495
496 [MethodImpl(MethodImplOptions.AggressiveInlining)]
497 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
498 static long INumber<long>.CreateSaturating<TOther>(TOther value)
499 {
500 if (typeof(TOther) == typeof(byte))
501 {
502 return (byte)(object)value;
503 }
504 if (typeof(TOther) == typeof(char))
505 {
506 return (char)(object)value;
507 }
508 if (typeof(TOther) == typeof(decimal))
509 {
510 decimal num = (decimal)(object)value;
511 if (!(num > 9223372036854775807m))
512 {
513 if (!(num < -9223372036854775808m))
514 {
515 return (long)num;
516 }
517 return long.MinValue;
518 }
519 return long.MaxValue;
520 }
521 if (typeof(TOther) == typeof(double))
522 {
523 double num2 = (double)(object)value;
524 if (!(num2 > 9.223372036854776E+18))
525 {
526 if (!(num2 < -9.223372036854776E+18))
527 {
528 return (long)num2;
529 }
530 return long.MinValue;
531 }
532 return long.MaxValue;
533 }
534 if (typeof(TOther) == typeof(short))
535 {
536 return (short)(object)value;
537 }
538 if (typeof(TOther) == typeof(int))
539 {
540 return (int)(object)value;
541 }
542 if (typeof(TOther) == typeof(long))
543 {
544 return (long)(object)value;
545 }
546 if (typeof(TOther) == typeof(IntPtr))
547 {
548 return (long)(IntPtr)(object)value;
549 }
550 if (typeof(TOther) == typeof(sbyte))
551 {
552 return (sbyte)(object)value;
553 }
554 if (typeof(TOther) == typeof(float))
555 {
556 float num3 = (float)(object)value;
557 if (!(num3 > 9.223372E+18f))
558 {
559 if (!(num3 < -9.223372E+18f))
560 {
561 return (long)num3;
562 }
563 return long.MinValue;
564 }
565 return long.MaxValue;
566 }
567 if (typeof(TOther) == typeof(ushort))
568 {
569 return (ushort)(object)value;
570 }
571 if (typeof(TOther) == typeof(uint))
572 {
573 return (uint)(object)value;
574 }
575 if (typeof(TOther) == typeof(ulong))
576 {
577 ulong num4 = (ulong)(object)value;
578 if (num4 <= long.MaxValue)
579 {
580 return (long)num4;
581 }
582 return long.MaxValue;
583 }
584 if (typeof(TOther) == typeof(UIntPtr))
585 {
586 UIntPtr uIntPtr = (UIntPtr)(object)value;
587 if ((ulong)(nuint)uIntPtr <= 9223372036854775807uL)
588 {
589 return (long)(nuint)uIntPtr;
590 }
591 return long.MaxValue;
592 }
594 return 0L;
595 }
596
597 [MethodImpl(MethodImplOptions.AggressiveInlining)]
598 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
599 static long INumber<long>.CreateTruncating<TOther>(TOther value)
600 {
601 if (typeof(TOther) == typeof(byte))
602 {
603 return (byte)(object)value;
604 }
605 if (typeof(TOther) == typeof(char))
606 {
607 return (char)(object)value;
608 }
609 if (typeof(TOther) == typeof(decimal))
610 {
611 return (long)(decimal)(object)value;
612 }
613 if (typeof(TOther) == typeof(double))
614 {
615 return (long)(double)(object)value;
616 }
617 if (typeof(TOther) == typeof(short))
618 {
619 return (short)(object)value;
620 }
621 if (typeof(TOther) == typeof(int))
622 {
623 return (int)(object)value;
624 }
625 if (typeof(TOther) == typeof(long))
626 {
627 return (long)(object)value;
628 }
629 if (typeof(TOther) == typeof(IntPtr))
630 {
631 return (long)(IntPtr)(object)value;
632 }
633 if (typeof(TOther) == typeof(sbyte))
634 {
635 return (sbyte)(object)value;
636 }
637 if (typeof(TOther) == typeof(float))
638 {
639 return (long)(float)(object)value;
640 }
641 if (typeof(TOther) == typeof(ushort))
642 {
643 return (ushort)(object)value;
644 }
645 if (typeof(TOther) == typeof(uint))
646 {
647 return (uint)(object)value;
648 }
649 if (typeof(TOther) == typeof(ulong))
650 {
651 return (long)(ulong)(object)value;
652 }
653 if (typeof(TOther) == typeof(UIntPtr))
654 {
655 return (long)(nuint)(UIntPtr)(object)value;
656 }
658 return 0L;
659 }
660
661 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
662 static (long Quotient, long Remainder) INumber<long>.DivRem(long left, long right)
663 {
664 return Math.DivRem(left, right);
665 }
666
667 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
668 static long INumber<long>.Max(long x, long y)
669 {
670 return Math.Max(x, y);
671 }
672
673 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
674 static long INumber<long>.Min(long x, long y)
675 {
676 return Math.Min(x, y);
677 }
678
679 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
680 static long INumber<long>.Parse(string s, NumberStyles style, IFormatProvider provider)
681 {
682 return Parse(s, style, provider);
683 }
684
685 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
687 {
688 return Parse(s, style, provider);
689 }
690
691 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
692 static long INumber<long>.Sign(long value)
693 {
694 return Math.Sign(value);
695 }
696
697 [MethodImpl(MethodImplOptions.AggressiveInlining)]
698 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
699 static bool INumber<long>.TryCreate<TOther>(TOther value, out long result)
700 {
701 if (typeof(TOther) == typeof(byte))
702 {
703 result = (byte)(object)value;
704 return true;
705 }
706 if (typeof(TOther) == typeof(char))
707 {
708 result = (char)(object)value;
709 return true;
710 }
711 if (typeof(TOther) == typeof(decimal))
712 {
713 decimal num = (decimal)(object)value;
714 if (num < -9223372036854775808m || num > 9223372036854775807m)
715 {
716 result = 0L;
717 return false;
718 }
719 result = (long)num;
720 return true;
721 }
722 if (typeof(TOther) == typeof(double))
723 {
724 double num2 = (double)(object)value;
725 if (num2 < -9.223372036854776E+18 || num2 > 9.223372036854776E+18)
726 {
727 result = 0L;
728 return false;
729 }
730 result = (long)num2;
731 return true;
732 }
733 if (typeof(TOther) == typeof(short))
734 {
735 result = (short)(object)value;
736 return true;
737 }
738 if (typeof(TOther) == typeof(int))
739 {
740 result = (int)(object)value;
741 return true;
742 }
743 if (typeof(TOther) == typeof(long))
744 {
745 result = (long)(object)value;
746 return true;
747 }
748 if (typeof(TOther) == typeof(IntPtr))
749 {
750 result = (long)(IntPtr)(object)value;
751 return true;
752 }
753 if (typeof(TOther) == typeof(sbyte))
754 {
755 result = (sbyte)(object)value;
756 return true;
757 }
758 if (typeof(TOther) == typeof(float))
759 {
760 float num3 = (float)(object)value;
761 if (num3 < -9.223372E+18f || num3 > 9.223372E+18f)
762 {
763 result = 0L;
764 return false;
765 }
766 result = (long)num3;
767 return true;
768 }
769 if (typeof(TOther) == typeof(ushort))
770 {
771 result = (ushort)(object)value;
772 return true;
773 }
774 if (typeof(TOther) == typeof(uint))
775 {
776 result = (uint)(object)value;
777 return true;
778 }
779 if (typeof(TOther) == typeof(ulong))
780 {
781 ulong num4 = (ulong)(object)value;
782 if (num4 > long.MaxValue)
783 {
784 result = 0L;
785 return false;
786 }
787 result = (long)num4;
788 return true;
789 }
790 if (typeof(TOther) == typeof(UIntPtr))
791 {
792 UIntPtr uIntPtr = (UIntPtr)(object)value;
793 if ((ulong)(nuint)uIntPtr > 9223372036854775807uL)
794 {
795 result = 0L;
796 return false;
797 }
798 result = (long)(nuint)uIntPtr;
799 return true;
800 }
802 result = 0L;
803 return false;
804 }
805
806 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
807 static bool INumber<long>.TryParse([NotNullWhen(true)] string s, NumberStyles style, IFormatProvider provider, out long result)
808 {
809 return TryParse(s, style, provider, out result);
810 }
811
812 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
813 static bool INumber<long>.TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out long result)
814 {
815 return TryParse(s, style, provider, out result);
816 }
817
818 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
819 static long IParseable<long>.Parse(string s, IFormatProvider provider)
820 {
821 return Parse(s, provider);
822 }
823
824 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
825 static bool IParseable<long>.TryParse([NotNullWhen(true)] string s, IFormatProvider provider, out long result)
826 {
827 return TryParse(s, NumberStyles.Integer, provider, out result);
828 }
829
830 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
831 static long IShiftOperators<long, long>.operator <<(long value, int shiftAmount)
832 {
833 return value << shiftAmount;
834 }
835
836 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
837 static long IShiftOperators<long, long>.operator >>(long value, int shiftAmount)
838 {
839 return value >> shiftAmount;
840 }
841
842 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
844 {
845 return Parse(s, NumberStyles.Integer, provider);
846 }
847
848 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
849 static bool ISpanParseable<long>.TryParse(ReadOnlySpan<char> s, IFormatProvider provider, out long result)
850 {
851 return TryParse(s, NumberStyles.Integer, provider, out result);
852 }
853
854 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
855 static long ISubtractionOperators<long, long, long>.operator -(long left, long right)
856 {
857 return left - right;
858 }
859
860 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
861 static long IUnaryNegationOperators<long, long>.operator -(long value)
862 {
863 return -value;
864 }
865
866 [RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
867 static long IUnaryPlusOperators<long, long>.operator +(long value)
868 {
869 return value;
870 }
871}
static decimal ToDecimal(object? value)
Definition Convert.cs:2101
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 uint ToUInt32(object? value)
Definition Convert.cs:1470
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 double Abs(double value)
static int DivRem(int a, int b, out int result)
Definition Math.cs:329
static int Sign(decimal value)
Definition Math.cs:1202
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static bool TryFormatInt64(long value, ReadOnlySpan< char > format, IFormatProvider provider, Span< char > destination, out int charsWritten)
Definition Number.cs:2099
static string Int64ToDecStr(long value)
Definition Number.cs:2475
static long ParseInt64(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info)
Definition Number.cs:4008
static ParsingStatus TryParseInt64IntegerStyle(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out long result)
Definition Number.cs:4492
static ParsingStatus TryParseInt64(ReadOnlySpan< char > value, NumberStyles styles, NumberFormatInfo info, out long result)
Definition Number.cs:4704
static string FormatInt64(long value, string format, IFormatProvider provider)
Definition Number.cs:2052
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 InvalidCast_FromTo
Definition SR.cs:1392
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Arg_MustBeInt64
Definition SR.cs:284
Definition SR.cs:7
static void ThrowNotSupportedException(ExceptionResource resource)
static void ThrowValueArgumentOutOfRange_NeedNonNegNumException()
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 TSelf NegativeOne
static bool TryParse(ReadOnlySpan< char > s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(ReadOnlySpan< char > s, IFormatProvider? provider)
TypeCode
Definition TypeCode.cs:4
TypeCode GetTypeCode()
Definition Int64.cs:195
static long Parse(string s, IFormatProvider? provider)
Definition Int64.cs:138
static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out long result)
Definition Int64.cs:178
static long Parse(string s)
Definition Int64.cs:119
static bool TryParse(ReadOnlySpan< char > s, NumberStyles style, IFormatProvider? provider, out long result)
Definition Int64.cs:189
readonly long m_value
Definition Int64.cs:13
const long MaxValue
Definition Int64.cs:15
static long Parse(string s, NumberStyles style, IFormatProvider? provider)
Definition Int64.cs:147
int CompareTo(long value)
Definition Int64.cs:61
override bool Equals([NotNullWhen(true)] object? obj)
Definition Int64.cs:74
static long long Remainder INumber< long >. DivRem(long left, long right)
Definition Int64.cs:662
static bool TryParse(ReadOnlySpan< char > s, out long result)
Definition Int64.cs:173
string ToString(string? format)
Definition Int64.cs:104
bool Equals(long obj)
Definition Int64.cs:84
static bool TryParse([NotNullWhen(true)] string? s, out long result)
Definition Int64.cs:163
int CompareTo(object? value)
Definition Int64.cs:40
override int GetHashCode()
Definition Int64.cs:89
static long Quotient
Definition Int64.cs:662
string ToString(string? format, IFormatProvider? provider)
Definition Int64.cs:109
bool TryFormat(Span< char > destination, out int charsWritten, ReadOnlySpan< char > format=default(ReadOnlySpan< char >), IFormatProvider? provider=null)
Definition Int64.cs:114
override string ToString()
Definition Int64.cs:94
static long Parse(ReadOnlySpan< char > s, NumberStyles style=NumberStyles.Integer, IFormatProvider? provider=null)
Definition Int64.cs:157
string ToString(IFormatProvider? provider)
Definition Int64.cs:99
const long MinValue
Definition Int64.cs:17
static long Parse(string s, NumberStyles style)
Definition Int64.cs:128
static UIntPtr MaxValue
Definition UIntPtr.cs:31