how to perform a 64-bit addition in c? but the following code fails? why?

I have taken this code from stack overflow. But this doesnot works. Pls help me. I need to perform 64-bit addition in c. I am using 32-bit compiler.

:chomp: :chomp:

/* break up the 64bit number into smaller, 16bit chunks */

struct longint {

uint16 word0;

uint16 word1;

uint16 word2;

uint16 word3;

};

uint16 add(longint *result, longint *a, longint *b)

{

/* use an intermediate large enough to hold the result

of adding two 16 bit numbers together. */

uint32 partial;

/* add the chunks together, least significant bit first */

partial = a->word0 + b->word0;

/* extract thie low 16 bits of the sum and store it */

result->word0 = partial & 0x0000FFFF;

/* add the overflow to the next chunk of 16 */

partial = partial >> 16 + a->word1 + b->word1;

/* keep doing this for the remaining bits */

result->word1 = partial & 0x0000FFFF;

partial = partial >> 16 + a->word2 + b->word2;

result->word2 = partial & 0x0000FFFF;

partial = partial >> 16 + a->word3 + b->word3;

result->word3 = partial & 0x0000FFFF;

/* if the result overflowed, return nonzero */

return partial >> 16;

}

*Edited 4 Years Ago by arunsolo1984*: n/a