public Mul ( |
||
regMul | ||
return | void |
public void Mul(ref BigIntegerBuilder regMul) {
if (regMul._iuLast == 0) {
this.Mul(regMul._uSmall);
}
else if (this._iuLast == 0) {
uint u = this._uSmall;
switch (u) {
case 1:
this = new BigIntegerBuilder(ref regMul);
return;
case 0:
return;
}
this.Load(ref regMul, 1);
this.Mul(u);
}
else {
int num2 = this._iuLast + 1;
this.SetSizeKeep(num2 + regMul._iuLast, 1);
int index = num2;
while (--index >= 0) {
uint num4 = this._rgu[index];
this._rgu[index] = 0;
uint uCarry = 0;
for (int i = 0; i <= regMul._iuLast; i++) {
uCarry = AddMulCarry(ref this._rgu[index + i], regMul._rgu[i], num4, uCarry);
}
if (uCarry != 0) {
for (int j = (index + regMul._iuLast) + 1; (uCarry != 0) && (j <= this._iuLast); j++) {
uCarry = AddCarry(ref this._rgu[j], 0, uCarry);
}
if (uCarry != 0) {
this.SetSizeKeep(this._iuLast + 2, 0);
this._rgu[this._iuLast] = uCarry;
}
}
}
}
}
/// <summary>Multiplies two specified <see cref="BigInteger" /> values.</summary> /// <returns>The product of <paramref name="left" /> and <paramref name="right" />.</returns> /// <param name="left">The first value to multiply.</param> /// <param name="right">The second value to multiply.</param> public static BigInteger operator *(BigInteger left, BigInteger right) { var sign = 1; var regLeft = new BigIntegerBuilder(left, ref sign); var regRight = new BigIntegerBuilder(right, ref sign); regLeft.Mul(ref regRight); return(regLeft.GetInteger(sign)); }