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

MultiplyMod2p32pmod() public static method

Multiplies the data in x [xOffset:xOffset+xLen] by y [yOffset:yOffset+yLen] and puts the low mod words into d [dOffset:dOffset+mod].
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+mod].
public static MultiplyMod2p32pmod ( uint x, int xOffset, int xLen, uint y, int yOffest, int yLen, uint d, int dOffset, int mod ) : void
x uint
xOffset int
xLen int
y uint
yOffest int
yLen int
d uint
dOffset int
mod int
return void
			public static unsafe void MultiplyMod2p32pmod (uint [] x, int xOffset, int xLen, uint [] y, int yOffest, int yLen, uint [] d, int dOffset, int mod)
			{
				fixed (uint* xx = x, yy = y, dd = d) {
					uint* xP = xx + xOffset,
						xE = xP + xLen,
						yB = yy + yOffest,
						yE = yB + yLen,
						dB = dd + dOffset,
						dE = dB + mod;

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

						if (*xP == 0) continue;

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

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

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