/****************************************************************************** * * * 128-BIT ADD * * 01/12/07 (dkc) * * * ******************************************************************************/ unsigned int carry(unsigned int a, unsigned int b, unsigned int sum); void add128(unsigned int *a, unsigned int *b) { unsigned int a0,a1,a2,a3,b0,b1,b2,b3; unsigned int s0,s1,s2,s3,temp,c1,c2,c3; a0=*a; a1=*(a+1); a2=*(a+2); a3=*(a+3); b0=*b; b1=*(b+1); b2=*(b+2); b3=*(b+3); s3=a3+b3; c3=carry(a3,b3,s3); s2=a2+b2; c2=carry(a2,b2,s2); s1=a1+b1; c1=carry(a1,b1,s1); s0=a0+b0; temp=s2+c3; c2+=carry(s2,c3,temp); s2=temp; temp=s1+c2; c1+=carry(s1,c2,temp); s1=temp; s0=s0+c1; *b=s0; *(b+1)=s1; *(b+2)=s2; *(b+3)=s3; return; }