Mono.Math.BigInteger.Kernel.Multiply C# (CSharp) Method

Multiply() public static method

Multiplies the data in x [xOffset:xOffset+xLen] by y [yOffset:yOffset+yLen] and puts it into d [dOffset:dOffset+xLen+yLen].
This code is unsafe! It is the caller's responsibility to make sure that it is safe to access x [xOffset:xOffset+xLen], y [yOffset:yOffset+yLen], and d [dOffset:dOffset+xLen+yLen].
public static Multiply ( uint x, uint xOffset, uint xLen, uint y, uint yOffset, uint yLen, uint d, uint dOffset ) : void
x uint
xOffset uint
xLen uint
y uint
yOffset uint
yLen uint
d uint
dOffset uint
return void
			public static unsafe void Multiply (uint [] x, uint xOffset, uint xLen, uint [] y, uint yOffset, uint yLen, uint [] d, uint dOffset)
			{
				fixed (uint* xx = x, yy = y, dd = d) {
					uint* xP = xx + xOffset,
						xE = xP + xLen,
						yB = yy + yOffset,
						yE = yB + yLen,
						dB = dd + dOffset;

					for (; xP < xE; xP++, dB++) {

						if (*xP == 0) continue;

						ulong mcarry = 0;

						uint* dP = dB;
						for (uint* yP = yB; yP < yE; yP++, dP++) {
							mcarry += ((ulong)*xP * (ulong)*yP) + (ulong)*dP;

							*dP = (uint)mcarry;
							mcarry >>= 32;
						}

						if (mcarry != 0)
							*dP = (uint)mcarry;
					}
				}
			}