34 writes to _sign
System.Runtime.Numerics (34)
System\Numerics\BigInteger.cs (34)
58_sign = value; 69_sign = (int)value; 74_sign = +1; 85_sign = (int)value; 98_sign = -1; 103_sign = +1; 127_sign = (int)value; 132_sign = +1; 138_sign = +1; 165_sign = 0; 191_sign = -_sign; 197_sign = -_sign; 218_sign = sign; 244_sign = bits[0]; 245_sign *= ((bits[3] & signMask) != 0) ? -1 : +1; 261_sign = ((bits[3] & signMask) != 0) ? -1 : +1; 322_sign = 0; 330_sign = isNegative ? unchecked((int)0xffffffff) : 0; 336_sign = (_sign << 8) | value[i]; 343_sign = (_sign << 8) | value[i]; 355_sign = +1; 447_sign = (-1) * ((int)val[0]); 459_sign = -1; 465_sign = -1; 471_sign = +1; 485_sign = n; 518_sign = negative ? -(int)value[0] : (int)value[0]; 528_sign = negative ? -1 : +1; 534_sign = negative ? -1 : +1; 594_sign = unchecked((int)value[0]); 600_sign = +1; 605_sign = unchecked((int)value[0]); 619_sign = -1; 623_sign = +1;
213 references to _sign
System.Runtime.Numerics (213)
System\Number.BigInteger.cs (5)
612value._sign >= 0 ? '0' : (format == 'x') ? 'f' : 'F', 651int charsInHighByte = 9 - byte.LeadingZeroCount(value._sign >= 0 ? highByte : (byte)~highByte); 693sb.Append(value._sign >= 0 ? '0' : '1', digits - charsForBits); 774spanSuccess = value._sign.TryFormat(destination, out charsWritten, formatSpan, info); 782return value._sign.ToString(formatString, info);
System\Numerics\BigInteger.cs (208)
191_sign = -_sign; 197_sign = -_sign; 336_sign = (_sign << 8) | value[i]; 343_sign = (_sign << 8) | value[i]; 348if (_sign < 0 && !isNegative) 354_bits = new uint[1] { unchecked((uint)_sign) }; 357if (_sign == int.MinValue) 643return BitOperations.IsPow2(_sign); 645if (_sign != 1) 654public bool IsZero { get { AssertValid(); return _sign == 0; } } 656public bool IsOne { get { AssertValid(); return _sign == 1 && _bits == null; } } 658public bool IsEven { get { AssertValid(); return _bits == null ? (_sign & 1) == 0 : (_bits[0] & 1) == 0; } } 662get { AssertValid(); return (_sign >> (kcbitUint - 1)) - (-_sign >> (kcbitUint - 1)); } 757(quotient, remainder) = Math.DivRem(dividend._sign, divisor._sign); 784BigIntegerCalculator.Divide(dividend._bits, NumericsHelpers.Abs(divisor._sign), quotient, out rest); 786remainder = dividend._sign < 0 ? -1 * rest : rest; 787return new BigInteger(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 819remainder = new BigInteger(rest, dividend._sign < 0); 820var result = new BigInteger(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 844if (value._sign < 0 || baseValue == 1.0D) 851return Math.Log(value._sign, baseValue); 884return BigIntegerCalculator.Gcd(NumericsHelpers.Abs(left._sign), NumericsHelpers.Abs(right._sign)); 890return left._sign != 0 891? BigIntegerCalculator.Gcd(right._bits, NumericsHelpers.Abs(left._sign)) 898return right._sign != 0 899? BigIntegerCalculator.Gcd(left._bits, NumericsHelpers.Abs(right._sign)) 987uint bits = trivialValue && trivialExponent ? BigIntegerCalculator.Pow(NumericsHelpers.Abs(value._sign), NumericsHelpers.Abs(exponent._sign), NumericsHelpers.Abs(modulus._sign)) : 988trivialValue ? BigIntegerCalculator.Pow(NumericsHelpers.Abs(value._sign), exponent._bits!, NumericsHelpers.Abs(modulus._sign)) : 989trivialExponent ? BigIntegerCalculator.Pow(value._bits!, NumericsHelpers.Abs(exponent._sign), NumericsHelpers.Abs(modulus._sign)) : 990BigIntegerCalculator.Pow(value._bits!, exponent._bits!, NumericsHelpers.Abs(modulus._sign)); 992result = value._sign < 0 && !exponent.IsEven ? -1 * bits : bits; 1006BigIntegerCalculator.Pow(NumericsHelpers.Abs(value._sign), NumericsHelpers.Abs(exponent._sign), modulus._bits!, bits); 1010BigIntegerCalculator.Pow(NumericsHelpers.Abs(value._sign), exponent._bits!, modulus._bits!, bits); 1015BigIntegerCalculator.Pow(value._bits!, NumericsHelpers.Abs(exponent._sign), modulus._bits!, bits); 1022result = new BigInteger(bits, value._sign < 0 && !exponent.IsEven); 1050if (value._sign == 1) 1052if (value._sign == -1) 1054if (value._sign == 0) 1063BigIntegerCalculator.Pow(NumericsHelpers.Abs(value._sign), power, bits); 1064result = new BigInteger(bits, value._sign < 0 && (exponent & 1) != 0); 1075result = new BigInteger(bits, value._sign < 0 && (exponent & 1) != 0); 1089return _sign; 1093hash.Add(_sign); 1109return _sign == other; 1112if ((_sign ^ other) < 0 || (cu = _bits.Length) > 2) 1127if (_sign < 0) 1130return (ulong)_sign == other; 1145return _sign == other._sign && _bits.AsSpan().SequenceEqual(other._bits); 1153return ((long)_sign).CompareTo(other); 1155if ((_sign ^ other) < 0 || (cu = _bits.Length) > 2) 1156return _sign; 1159return _sign * uuTmp.CompareTo(uu); 1167if (_sign < 0) 1170return ((ulong)_sign).CompareTo(other); 1183if ((_sign ^ other._sign) < 0) 1186return _sign < 0 ? -1 : +1; 1193return _sign < other._sign ? -1 : _sign > other._sign ? +1 : 0; 1194return -other._sign; 1198return _sign; 1201return _sign < 0 ? -bitsResult : bitsResult; 1331int sign = _sign; 1517Debug.Assert(_bits is null || _sign == 0 ? buffer.Length == 2 : buffer.Length >= _bits.Length + 1); 1523buffer[0] = unchecked((uint)_sign); 1524highDWord = (_sign < 0) ? uint.MaxValue : 0; 1530if (_sign == -1) 1632string signStr = _sign < 0 ? NumberFormatInfo.CurrentInfo.NegativeSign : ""; 1715return (long)left._sign - right._sign; 1717if (left._sign < 0 != right._sign < 0) 1718return Add(left._bits, left._sign, right._bits, -1 * right._sign); 1719return Subtract(left._bits, left._sign, right._bits, right._sign); 1806return value._sign; 1820return new decimal(lo, mi, hi, value._sign < 0, 0); 1827int sign = value._sign; 1878return value._sign; // Value packed into int32 sign 1885if (value._sign > 0) 1902return value._sign; 1921long ll = value._sign > 0 ? unchecked((long)uu) : unchecked(-(long)uu); 1922if ((ll > 0 && value._sign > 0) || (ll < 0 && value._sign < 0)) 1939return value._sign; 1967Int128 ll = (value._sign > 0) ? unchecked((Int128)uu) : unchecked(-(Int128)uu); 1969if (((ll > 0) && (value._sign > 0)) || ((ll < 0) && (value._sign < 0))) 2015return checked((uint)value._sign); 2017else if (value._bits.Length > 1 || value._sign < 0) 2033return checked((ulong)value._sign); 2037if (len > 2 || value._sign < 0) 2059return checked((UInt128)value._sign); 2064if ((len > 4) || (value._sign < 0)) 2340return left._sign & right._sign; 2343uint xExtend = (left._sign < 0) ? uint.MaxValue : 0; 2344uint yExtend = (right._sign < 0) ? uint.MaxValue : 0; 2396return left._sign | right._sign; 2399uint xExtend = (left._sign < 0) ? uint.MaxValue : 0; 2400uint yExtend = (right._sign < 0) ? uint.MaxValue : 0; 2447return left._sign ^ right._sign; 2450uint xExtend = (left._sign < 0) ? uint.MaxValue : 0; 2451uint yExtend = (right._sign < 0) ? uint.MaxValue : 0; 2654return new BigInteger(-value._sign, value._bits); 2679return (long)left._sign + right._sign; 2681if (left._sign < 0 != right._sign < 0) 2682return Subtract(left._bits, left._sign, right._bits, -1 * right._sign); 2683return Add(left._bits, left._sign, right._bits, right._sign); 2692return (long)left._sign * right._sign; 2694return Multiply(left._bits, left._sign, right._bits, right._sign); 2784return dividend._sign / divisor._sign; 2808BigIntegerCalculator.Divide(dividend._bits, NumericsHelpers.Abs(divisor._sign), quotient); 2809return new BigInteger(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 2832var result = new BigInteger(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 2851return dividend._sign % divisor._sign; 2864uint remainder = BigIntegerCalculator.Remainder(dividend._bits, NumericsHelpers.Abs(divisor._sign)); 2865return dividend._sign < 0 ? -1 * remainder : remainder; 2882var result = new BigInteger(bits, dividend._sign < 0); 3062int sign = _sign; 3117xd[0] = (uint)(_sign < 0 ? -_sign : _sign); 3123return _sign < 0; 3132Debug.Assert(_sign == 1 || _sign == -1); 3145Debug.Assert(_sign > int.MinValue); 3174return int.LeadingZeroCount(value._sign); 3180return (value._sign >= 0) ? uint.LeadingZeroCount(value._bits[^1]) : 0; 3190return int.PopCount(value._sign); 3195if (value._sign >= 0) 3514return int.TrailingZeroCount(value._sign); 3557int value = _sign; 3571if (_sign >= 0) 3613int value = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(_sign) : _sign; 3616else if (_sign >= 0) 3715int value = BitConverter.IsLittleEndian ? _sign : BinaryPrimitives.ReverseEndianness(_sign); 3718else if (_sign >= 0) 3816if (_sign < 0) 3866return 31 ^ uint.LeadingZeroCount((uint)(value._sign | 1)); 3920int currentSign = value._sign; 3927int targetSign = sign._sign; 3950return int.Sign(value._sign); 3953return value._sign; 4033return (value._sign & 1) == 0; 4057return value._sign < 0; 4073return (value._sign & 1) != 0; 4082return value._sign >= 0; 4098return value._sign == 0; 4638actualResult = (value._sign >= byte.MaxValue) ? byte.MaxValue : 4639(value._sign <= byte.MinValue) ? byte.MinValue : (byte)value._sign; 4655actualResult = (value._sign >= char.MaxValue) ? char.MaxValue : 4656(value._sign <= char.MinValue) ? char.MinValue : (char)value._sign; 4691actualResult = (value._sign >= short.MaxValue) ? short.MaxValue : 4692(value._sign <= short.MinValue) ? short.MinValue : (short)value._sign; 4708actualResult = (value._sign >= int.MaxValue) ? int.MaxValue : 4709(value._sign <= int.MinValue) ? int.MinValue : (int)value._sign; 4752actualResult = (value._sign >= sbyte.MaxValue) ? sbyte.MaxValue : 4753(value._sign <= sbyte.MinValue) ? sbyte.MinValue : (sbyte)value._sign; 4775actualResult = (value._sign >= ushort.MaxValue) ? ushort.MaxValue : 4776(value._sign <= ushort.MinValue) ? ushort.MinValue : (ushort)value._sign; 4838actualResult = (byte)value._sign; 4861actualResult = (char)value._sign; 4896actualResult = (short)value._sign; 4912actualResult = value._sign; 4943actualResult = value._sign; 4988actualResult = value._sign; 5019actualResult = value._sign; 5041actualResult = (sbyte)value._sign; 5070actualResult = (ushort)value._sign; 5093actualResult = (uint)value._sign; 5124actualResult = (ulong)value._sign; 5169actualResult = (UInt128)value._sign; 5200actualResult = (nuint)value._sign;