當前位置: 首頁>>代碼示例>>C#>>正文


C# BigInteger.Not方法代碼示例

本文整理匯總了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);
                }
            }
        }
開發者ID:tupunco,項目名稱:deveel-math,代碼行數:32,代碼來源:Logical.cs

示例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);
            }
        }
開發者ID:DeadlyEmbrace,項目名稱:NTRU-NET,代碼行數:43,代碼來源:Logical.cs

示例3: AndNot

        /// <summary>
        /// Returns a new BigInteger whose value is <c>this &amp; ~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 &amp; ~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);
            }
        }
開發者ID:DeadlyEmbrace,項目名稱:NTRU-NET,代碼行數:37,代碼來源:Logical.cs

示例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);
                }
            }
        }
開發者ID:tupunco,項目名稱:deveel-math,代碼行數:36,代碼來源:Logical.cs


注:本文中的BigInteger.Not方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。