/****************************************************************************** * * * 32x32 BIT MULTIPLY (UNSIGNED) * * 01/12/07 (dkc) * * * ******************************************************************************/ unsigned int carry(unsigned int a, unsigned int b, unsigned int sum); void mul32_32(unsigned int a0, unsigned int m0, unsigned int *product) { unsigned int a1,m1,temp; unsigned int p0,p1,p2,p3; unsigned int s1,s2; unsigned int c2; a1=a0&0xffff; a0=a0>>16; m1=m0&0xffff; m0=m0>>16; p0=a0*m0; p1=a0*m1; p2=a1*m0; p3=a1*m1; s2=p3+(p2<<16); c2=carry(p3,(p2<<16),s2); temp=s2+(p1<<16); c2+=carry(s2,(p1<<16),temp); s2=temp; s1=p0+(p2>>16); s1=s1+(p1>>16); s1=s1+c2; *product=s1; *(product+1)=s2; return; }