/****************************************************************************** * * * 1024-BIT ADD * * 03/28/10 (dkc) * * * ******************************************************************************/ unsigned int carry(unsigned int a, unsigned int b, unsigned int sum); void add1024(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 a8,a9,a10,a11,a12,a13,a14,a15,b8,b9,b10,b11,b12,b13,b14,b15; unsigned int a16,a17,a18,a19,a20,a21,a22,a23,b16,b17,b18,b19,b20,b21,b22,b23; unsigned int a24,a25,a26,a27,a28,a29,a30,a31,b24,b25,b26,b27,b28,b29,b30,b31; unsigned int s0,s1,s2,s3,s4,s5,s6,s7,temp,c1,c2,c3,c4,c5,c6,c7; unsigned int s8,s9,s10,s11,s12,s13,s14,s15,c8,c9,c10,c11,c12,c13,c14,c15; unsigned int s16,s17,s18,s19,s20,s21,s22,s23,c16,c17,c18,c19,c20,c21,c22,c23; unsigned int s24,s25,s26,s27,s28,s29,s30,s31,c24,c25,c26,c27,c28,c29,c30,c31; a0=*a; a1=*(a+1); a2=*(a+2); a3=*(a+3); a4=*(a+4); a5=*(a+5); a6=*(a+6); a7=*(a+7); a8=*(a+8); a9=*(a+9); a10=*(a+10); a11=*(a+11); a12=*(a+12); a13=*(a+13); a14=*(a+14); a15=*(a+15); a16=*(a+16); a17=*(a+17); a18=*(a+18); a19=*(a+19); a20=*(a+20); a21=*(a+21); a22=*(a+22); a23=*(a+23); a24=*(a+24); a25=*(a+25); a26=*(a+26); a27=*(a+27); a28=*(a+28); a29=*(a+29); a30=*(a+30); a31=*(a+31); b0=*b; b1=*(b+1); b2=*(b+2); b3=*(b+3); b4=*(b+4); b5=*(b+5); b6=*(b+6); b7=*(b+7); b8=*(b+8); b9=*(b+9); b10=*(b+10); b11=*(b+11); b12=*(b+12); b13=*(b+13); b14=*(b+14); b15=*(b+15); b16=*(b+16); b17=*(b+17); b18=*(b+18); b19=*(b+19); b20=*(b+20); b21=*(b+21); b22=*(b+22); b23=*(b+23); b24=*(b+24); b25=*(b+25); b26=*(b+26); b27=*(b+27); b28=*(b+28); b29=*(b+29); b30=*(b+30); b31=*(b+31); s31=a31+b31; c31=carry(a31,b31,s31); s30=a30+b30; c30=carry(a30,b30,s30); s29=a29+b29; c29=carry(a29,b29,s29); s28=a28+b28; c28=carry(a28,b28,s28); s27=a27+b27; c27=carry(a27,b27,s27); s26=a26+b26; c26=carry(a26,b26,s26); s25=a25+b25; c25=carry(a25,b25,s25); s24=a24+b24; c24=carry(a24,b24,s24); s23=a23+b23; c23=carry(a23,b23,s23); s22=a22+b22; c22=carry(a22,b22,s22); s21=a21+b21; c21=carry(a21,b21,s21); s20=a20+b20; c20=carry(a20,b20,s20); s19=a19+b19; c19=carry(a19,b19,s19); s18=a18+b18; c18=carry(a18,b18,s18); s17=a17+b17; c17=carry(a17,b17,s17); s16=a16+b16; c16=carry(a16,b16,s16); s15=a15+b15; c15=carry(a15,b15,s15); s14=a14+b14; c14=carry(a14,b14,s14); s13=a13+b13; c13=carry(a13,b13,s13); s12=a12+b12; c12=carry(a12,b12,s12); s11=a11+b11; c11=carry(a11,b11,s11); s10=a10+b10; c10=carry(a10,b10,s10); s9=a9+b9; c9=carry(a9,b9,s9); s8=a8+b8; c8=carry(a8,b8,s8); 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=s30+c31; c30+=carry(s30,c31,temp); s30=temp; temp=s29+c30; c29+=carry(s29,c30,temp); s29=temp; temp=s28+c29; c28+=carry(s28,c29,temp); s28=temp; temp=s27+c28; c27+=carry(s27,c28,temp); s27=temp; temp=s26+c27; c26+=carry(s26,c27,temp); s26=temp; temp=s25+c26; c25+=carry(s25,c26,temp); s25=temp; temp=s24+c25; c24+=carry(s24,c25,temp); s24=temp; temp=s23+c24; c23+=carry(s23,c24,temp); s23=temp; temp=s22+c23; c22+=carry(s22,c23,temp); s22=temp; temp=s21+c22; c21+=carry(s21,c22,temp); s21=temp; temp=s20+c21; c20+=carry(s20,c21,temp); s20=temp; temp=s19+c20; c19+=carry(s19,c20,temp); s19=temp; temp=s18+c19; c18+=carry(s18,c19,temp); s18=temp; temp=s17+c18; c17+=carry(s17,c18,temp); s17=temp; temp=s16+c17; c16+=carry(s16,c17,temp); s16=temp; temp=s15+c16; c15+=carry(s15,c16,temp); s15=temp; temp=s14+c15; c14+=carry(s14,c15,temp); s14=temp; temp=s13+c14; c13+=carry(s13,c14,temp); s13=temp; temp=s12+c13; c12+=carry(s12,c13,temp); s12=temp; temp=s11+c12; c11+=carry(s11,c12,temp); s11=temp; temp=s10+c11; c10+=carry(s10,c11,temp); s10=temp; temp=s9+c10; c9+=carry(s9,c10,temp); s9=temp; temp=s8+c9; c8+=carry(s8,c9,temp); s8=temp; temp=s7+c8; c7+=carry(s7,c8,temp); s7=temp; 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; *(b+8)=s8; *(b+9)=s9; *(b+10)=s10; *(b+11)=s11; *(b+12)=s12; *(b+13)=s13; *(b+14)=s14; *(b+15)=s15; *(b+16)=s16; *(b+17)=s17; *(b+18)=s18; *(b+19)=s19; *(b+20)=s20; *(b+21)=s21; *(b+22)=s22; *(b+23)=s23; *(b+24)=s24; *(b+25)=s25; *(b+26)=s26; *(b+27)=s27; *(b+28)=s28; *(b+29)=s29; *(b+30)=s30; *(b+31)=s31; return; }