本文整理匯總了C#中BigInteger.Not方法的典型用法代碼示例。如果您正苦於以下問題:C# BigInteger.Not方法的具體用法?C# BigInteger.Not怎麽用?C# BigInteger.Not使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BigInteger
的用法示例。
在下文中一共展示了BigInteger.Not方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AndNot
/** @see BigInteger#andNot(BigInteger) */
public static BigInteger AndNot(BigInteger val, BigInteger that)
{
if (that.Sign == 0) {
return val;
}
if (val.Sign == 0) {
return BigInteger.Zero;
}
if (val.Equals(BigInteger.MinusOne)) {
return that.Not();
}
if (that.Equals(BigInteger.MinusOne)) {
return BigInteger.Zero;
}
//if val == that, return 0
if (val.Sign > 0) {
if (that.Sign > 0) {
return AndNotPositive(val, that);
} else {
return AndNotPositiveNegative(val, that);
}
} else {
if (that.Sign > 0) {
return AndNotNegativePositive(val, that);
} else {
return AndNotNegative(val, that);
}
}
}
示例2: Xor
/// <summary>
/// Returns a new BigInteger whose value is <c>this ^ Value</c>
/// </summary>
///
/// <param name="Value">Value to be Xor'ed </param>
/// <param name="X">The second value</param>
///
/// <returns>Returns <c>this ^ Value</c></returns>
internal static BigInteger Xor(BigInteger Value, BigInteger X)
{
if (X._sign == 0)
return Value;
if (Value._sign == 0)
return X;
if (X.Equals(BigInteger.MinusOne))
return Value.Not();
if (Value.Equals(BigInteger.MinusOne))
return X.Not();
if (Value._sign > 0)
{
if (X._sign > 0)
{
if (Value._numberLength > X._numberLength)
return XorPositive(Value, X);
else
return XorPositive(X, Value);
}
else
{
return XorDiffSigns(Value, X);
}
}
else
{
if (X._sign > 0)
return XorDiffSigns(X, Value);
else if (X.FirstNonzeroDigit > Value.FirstNonzeroDigit)
return XorNegative(X, Value);
else
return XorNegative(Value, X);
}
}
示例3: AndNot
/// <summary>
/// Returns a new BigInteger whose value is <c>this & ~Value</c>.
/// <para>Evaluating <c>x.AndNot(Value)</c> returns the same result as <c>x.And(Value.Not())</c>.</para>
/// </summary>
///
/// <param name="Value">Value to be Not'ed and then And'ed</param>
/// <param name="X">The second value</param>
///
/// <returns><c>Value & ~X</c></returns>
internal static BigInteger AndNot(BigInteger Value, BigInteger X)
{
if (X._sign == 0)
return Value;
if (Value._sign == 0)
return BigInteger.Zero;
if (Value.Equals(BigInteger.MinusOne))
return X.Not();
if (X.Equals(BigInteger.MinusOne))
return BigInteger.Zero;
//if val == that, return 0
if (Value._sign > 0)
{
if (X._sign > 0)
return AndNotPositive(Value, X);
else
return AndNotPositiveNegative(Value, X);
}
else
{
if (X._sign > 0)
return AndNotNegativePositive(Value, X);
else
return AndNotNegative(Value, X);
}
}
示例4: Xor
/** @see BigInteger#xor(BigInteger) */
public static BigInteger Xor(BigInteger val, BigInteger that)
{
if (that.Sign == 0) {
return val;
}
if (val.Sign == 0) {
return that;
}
if (that.Equals(BigInteger.MinusOne)) {
return val.Not();
}
if (val.Equals(BigInteger.MinusOne)) {
return that.Not();
}
if (val.Sign > 0) {
if (that.Sign > 0) {
if (val.numberLength > that.numberLength) {
return XorPositive(val, that);
} else {
return XorPositive(that, val);
}
} else {
return XorDiffSigns(val, that);
}
} else {
if (that.Sign > 0) {
return XorDiffSigns(that, val);
} else if (that.FirstNonzeroDigit > val.FirstNonzeroDigit) {
return XorNegative(that, val);
} else {
return XorNegative(val, that);
}
}
}