/****************************************************************************** * * * 128-BIT SUBTRACT * * 01/12/07 (dkc) * * * ******************************************************************************/ unsigned int carry(unsigned int a, unsigned int b, unsigned int sum); void sub128(unsigned int *a, unsigned int *b) { unsigned int a0,a1,a2,a3,b0,b1,b2,b3; unsigned int s0,s1,s2,s3,temp,c,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); b0=~b0; b1=~b1; b2=~b2; b3=~b3; temp=b3+1; c=carry(b3,1,temp); b3=temp; temp=b2+c; c=carry(b2,c,temp); b2=temp; temp=b1+c; c=carry(b1,c,temp); b1=temp; b0=b0+c; 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; }