当前位置: 首页>>代码示例>>C#>>正文


C# BigInteger.unCache方法代码示例

本文整理汇总了C#中BigInteger.unCache方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.unCache方法的具体用法?C# BigInteger.unCache怎么用?C# BigInteger.unCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BigInteger的用法示例。


在下文中一共展示了BigInteger.unCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: inplaceAdd

 /**
  * Performs: {@code op1 += addend}. The number must to have place to hold a
  * possible carry.
  */
 internal static void inplaceAdd(BigInteger op1, int addend)
 {
     int carry = inplaceAdd(op1.digits, op1.numberLength, addend);
     if (carry == 1) {
         op1.digits[op1.numberLength] = 1;
         op1.numberLength++;
     }
     op1.unCache();
 }
开发者ID:gadfly,项目名称:nofs,代码行数:13,代码来源:java.math.Elementary.cs

示例2: inplaceSubtract

 /**
  * Performs {@code op1 -= op2}. {@code op1} must have enough place to store
  * the result (i.e. {@code op1.bitLength() >= op2.bitLength()}). Both
  * should be positive (what implies that {@code op1 >= op2}).
  *
  * @param op1
  *            the input minuend, and the output result.
  * @param op2
  *            the subtrahend
  */
 internal static void inplaceSubtract(BigInteger op1, BigInteger op2)
 {
     // PRE: op1 >= op2 > 0
     subtract (op1.digits, op1.digits, op1.numberLength, op2.digits,
             op2.numberLength);
     op1.cutOffLeadingZeroes ();
     op1.unCache();
 }
开发者ID:gadfly,项目名称:nofs,代码行数:18,代码来源:java.math.Elementary.cs

示例3: completeInPlaceSubtract

 /**
  * Same as
  *
  * @link #inplaceSubtract(BigInteger, BigInteger), but without the
  *       restriction of non-positive values
  * @param op1
  *            should have enough space to save the result
  * @param op2
  */
 internal static void completeInPlaceSubtract(BigInteger op1, BigInteger op2)
 {
     int resultSign = op1.compareTo (op2);
     if (op1.sign == 0) {
         java.lang.SystemJ.arraycopy (op2.digits, 0, op1.digits, 0, op2.numberLength);
         op1.sign = -op2.sign;
     } else if (op1.sign != op2.sign) {
         add (op1.digits, op1.digits, op1.numberLength, op2.digits,
             op2.numberLength);
         op1.sign = resultSign;
     } else {
         int sign = unsignedArraysCompare (op1.digits,
                 op2.digits, op1.numberLength, op2.numberLength);
         if (sign > 0) {
             subtract (op1.digits, op1.digits, op1.numberLength, op2.digits,
                     op2.numberLength);	// op1 = op1 - op2
             // op1.sign remains equal
         } else {
             inverseSubtract (op1.digits, op1.digits, op1.numberLength,
                     op2.digits, op2.numberLength);	// op1 = op2 - op1
             op1.sign = -op1.sign;
         }
     }
     op1.numberLength = java.lang.Math.max (op1.numberLength, op2.numberLength) + 1;
     op1.cutOffLeadingZeroes ();
     op1.unCache();
 }
开发者ID:gadfly,项目名称:nofs,代码行数:36,代码来源:java.math.Elementary.cs

示例4: completeInPlaceAdd

 /**
  * Same as @link #inplaceAdd(BigInteger, BigInteger), but without the restriction of
  *       non-positive values
  * @param op1 any number
  * @param op2 any number
  */
 internal static void completeInPlaceAdd(BigInteger op1, BigInteger op2)
 {
     if (op1.sign == 0)
         java.lang.SystemJ.arraycopy (op2.digits, 0, op1.digits, 0, op2.numberLength);
     else if (op2.sign == 0)
         return;
     else if (op1.sign == op2.sign)
         add (op1.digits, op1.digits, op1.numberLength, op2.digits,
                 op2.numberLength);
     else {
         int sign = unsignedArraysCompare(op1.digits,
                 op2.digits, op1.numberLength, op2.numberLength);
         if (sign > 0)
             subtract (op1.digits, op1.digits, op1.numberLength, op2.digits,
                     op2.numberLength);
         else {
             inverseSubtract (op1.digits, op1.digits, op1.numberLength,
                     op2.digits, op2.numberLength);
             op1.sign = -op1.sign;
         }
     }
     op1.numberLength = java.lang.Math.max (op1.numberLength, op2.numberLength) + 1;
     op1.cutOffLeadingZeroes ();
     op1.unCache();
 }
开发者ID:gadfly,项目名称:nofs,代码行数:31,代码来源:java.math.Elementary.cs

示例5: inplaceShiftRight

 /**
  * Performs {@code val >>= count} where {@code val} is a positive number.
  */
 internal static void inplaceShiftRight(BigInteger val, int count)
 {
     int sign = val.signum();
     if (count == 0 || val.signum() == 0)
         return;
     int intCount = count >> 5; // count of integers
     val.numberLength -= intCount;
     if (!shiftRight(val.digits, val.numberLength, val.digits, intCount,
             count & 31)
             && sign < 0) {
         // remainder not zero: add one to the result
         int i;
         for (i = 0; ( i < val.numberLength ) && ( val.digits[i] == -1 ); i++) {
             val.digits[i] = 0;
         }
         if (i == val.numberLength) {
             val.numberLength++;
         }
         val.digits[i]++;
     }
     val.cutOffLeadingZeroes();
     val.unCache();
 }
开发者ID:gadfly,项目名称:nofs,代码行数:26,代码来源:java.math.BitLevel.cs

示例6: inplaceShiftLeft

 /**
  * Performs {@code val <<= count}.
  */
 // val should have enough place (and one digit more)
 internal static void inplaceShiftLeft(BigInteger val, int count)
 {
     int intCount = count >> 5; // count of integers
     val.numberLength += intCount
             + ( java.lang.Integer
             .numberOfLeadingZeros(val.digits[val.numberLength - 1])
             - ( count & 31 ) >= 0 ? 0 : 1 );
     shiftLeft(val.digits, val.digits, intCount, count & 31);
     val.cutOffLeadingZeroes();
     val.unCache();
 }
开发者ID:gadfly,项目名称:nofs,代码行数:15,代码来源:java.math.BitLevel.cs


注:本文中的BigInteger.unCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。