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

◆ BigInteger() [7/12]

System.Numerics.BigInteger.BigInteger ( decimal value)
inline

Definition at line 245 of file BigInteger.cs.

246 {
247 Span<int> destination = stackalloc int[4];
248 decimal.GetBits(decimal.Truncate(value), destination);
249 int num = 3;
250 while (num > 0 && destination[num - 1] == 0)
251 {
252 num--;
253 }
254 switch (num)
255 {
256 case 0:
257 this = s_bnZeroInt;
258 return;
259 case 1:
260 if (destination[0] > 0)
261 {
262 _sign = destination[0];
263 _sign *= (((destination[3] & int.MinValue) == 0) ? 1 : (-1));
264 _bits = null;
265 return;
266 }
267 break;
268 }
269 _bits = new uint[num];
270 _bits[0] = (uint)destination[0];
271 if (num > 1)
272 {
273 _bits[1] = (uint)destination[1];
274 }
275 if (num > 2)
276 {
277 _bits[2] = (uint)destination[2];
278 }
279 _sign = (((destination[3] & int.MinValue) == 0) ? 1 : (-1));
280 }
readonly uint[] _bits
Definition BigInteger.cs:20
static readonly BigInteger s_bnZeroInt
Definition BigInteger.cs:26

References System.Numerics.BigInteger._bits, System.Numerics.BigInteger._sign, System.destination, System.Numerics.BigInteger.s_bnZeroInt, and System.value.