﻿ /*******************************
```/******************************************************************************
*									      *
*  03/28/10 (dkc)							      *
*									      *
******************************************************************************/
unsigned int carry(unsigned int a, unsigned int b, unsigned int sum);
void add512(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 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;
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);

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);

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=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;
return;
}
```