/****************************************************************************** * * * 256-BIT ADD * * 01/12/07 (dkc) * * * ******************************************************************************/ unsigned int carry(unsigned int a, unsigned int b, unsigned int sum); void add256(unsigned int *a, unsigned int *b) { unsigned int a0,a1,a2,a3,a4,a5,a6,a7,b0,b1,b2,b3,b4,b5,b6,b7; unsigned int s0,s1,s2,s3,s4,s5,s6,s7,temp,c1,c2,c3,c4,c5,c6,c7; a0=*a; a1=*(a+1); a2=*(a+2); a3=*(a+3); a4=*(a+4); a5=*(a+5); a6=*(a+6); a7=*(a+7); b0=*b; b1=*(b+1); b2=*(b+2); b3=*(b+3); b4=*(b+4); b5=*(b+5); b6=*(b+6); b7=*(b+7); s7=a7+b7; c7=carry(a7,b7,s7); s6=a6+b6; c6=carry(a6,b6,s6); s5=a5+b5; c5=carry(a5,b5,s5); s4=a4+b4; c4=carry(a4,b4,s4); 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=s6+c7; c6+=carry(s6,c7,temp); s6=temp; temp=s5+c6; c5+=carry(s5,c6,temp); s5=temp; temp=s4+c5; c4+=carry(s4,c5,temp); s4=temp; temp=s3+c4; c3+=carry(s3,c4,temp); s3=temp; 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; *(b+4)=s4; *(b+5)=s5; *(b+6)=s6; *(b+7)=s7; return; }