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