Example #1
0
 public static void Gcd(ref BigIntegerBuilder reg1, ref BigIntegerBuilder reg2)
 {
     if ((reg1._iuLast <= 0 || reg1._bits[0] != 0) && (reg2._iuLast <= 0 || reg2._bits[0] != 0))
     {
         LehmerGcd(ref reg1, ref reg2);
     }
     else
     {
         var num  = reg1.MakeOdd();
         var num1 = reg2.MakeOdd();
         LehmerGcd(ref reg1, ref reg2);
         var num2 = Math.Min(num, num1);
         if (num2 > 0)
         {
             reg1.ShiftLeft(num2);
         }
     }
 }
Example #2
0
 public static void Gcd(ref BigIntegerBuilder reg1, ref BigIntegerBuilder reg2)
 {
     if ((reg1._iuLast <= 0 || reg1._bits[0] != 0) && (reg2._iuLast <= 0 || reg2._bits[0] != 0))
     {
         LehmerGcd(ref reg1, ref reg2);
     }
     else
     {
         var num = reg1.MakeOdd();
         var num1 = reg2.MakeOdd();
         LehmerGcd(ref reg1, ref reg2);
         var num2 = Math.Min(num, num1);
         if (num2 > 0)
         {
             reg1.ShiftLeft(num2);
         }
     }
 }