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

◆ GetBitLength()

long System.Numerics.BigInteger.GetBitLength ( )
inline

Definition at line 2112 of file BigInteger.cs.

2113 {
2114 int sign = _sign;
2115 uint[] bits = _bits;
2116 int num;
2117 uint num2;
2118 if (bits == null)
2119 {
2120 num = 1;
2121 num2 = (uint)((sign < 0) ? (-sign) : sign);
2122 }
2123 else
2124 {
2125 num = bits.Length;
2126 num2 = bits[num - 1];
2127 }
2128 long num3 = (long)num * 32L - BitOperations.LeadingZeroCount(num2);
2129 if (sign >= 0)
2130 {
2131 return num3;
2132 }
2133 if ((num2 & (num2 - 1)) != 0)
2134 {
2135 return num3;
2136 }
2137 for (int num4 = num - 2; num4 >= 0; num4--)
2138 {
2139 if (bits[num4] != 0)
2140 {
2141 return num3;
2142 }
2143 }
2144 return num3 - 1;
2145 }
readonly uint[] _bits
Definition BigInteger.cs:20

References System.Numerics.BigInteger._bits, System.Numerics.BigInteger._sign, System.L, and System.Numerics.BitOperations.LeadingZeroCount().