Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ operator<<()

static BigInteger System.Numerics.BigInteger.operator<< ( BigInteger value,
int shift )
inlinestatic

Definition at line 1680 of file BigInteger.cs.

1681 {
1682 if (shift == 0)
1683 {
1684 return value;
1685 }
1686 if (shift == int.MinValue)
1687 {
1688 return value >> int.MaxValue >> 1;
1689 }
1690 if (shift < 0)
1691 {
1692 return value >> -shift;
1693 }
1694 (int Quotient, int Remainder) tuple = Math.DivRem(shift, 32);
1695 int item = tuple.Quotient;
1696 int item2 = tuple.Remainder;
1697 Span<uint> span = stackalloc uint[1];
1698 Span<uint> xd = span;
1699 bool partsForBitManipulation = GetPartsForBitManipulation(ref value, ref xd);
1700 int num = xd.Length + item + 1;
1701 uint[] valueArray = null;
1702 Span<uint> span2 = default(Span<uint>);
1703 if (num <= 64)
1704 {
1705 span = stackalloc uint[64];
1706 span2 = span.Slice(0, num);
1707 span = span2.Slice(0, item);
1708 span.Clear();
1709 }
1710 else
1711 {
1712 span2 = (valueArray = new uint[num]);
1713 }
1714 uint num2 = 0u;
1715 if (item2 == 0)
1716 {
1717 for (int i = 0; i < xd.Length; i++)
1718 {
1719 span2[i + item] = xd[i];
1720 }
1721 }
1722 else
1723 {
1724 int num3 = 32 - item2;
1725 for (int j = 0; j < xd.Length; j++)
1726 {
1727 uint num4 = xd[j];
1728 span2[j + item] = (num4 << item2) | num2;
1729 num2 = num4 >> num3;
1730 }
1731 }
1732 span2[^1] = num2;
1733 return new BigInteger(span2, valueArray, partsForBitManipulation);
1734 }
static bool GetPartsForBitManipulation(ref BigInteger x, ref Span< uint > xd)
static BigInteger Remainder(BigInteger dividend, BigInteger divisor)

References System.Numerics.BigInteger.BigInteger(), System.Span< T >.Clear(), System.Math.DivRem(), System.Numerics.BigInteger.GetPartsForBitManipulation(), System.item, System.Span< T >.Length, System.Numerics.BigInteger.Remainder(), System.Span< T >.Slice(), and System.value.