Q:

how do I divide large number into two smaller integers and then reassemble the large number?

i have tried the below but do not seem to get the correct value in the end:
I have a number that may be larger than 32bit and hence I want to store it into two 32 bit array indices. 
I broke them up like:
int[0] = lgval%(2^32);
int[1] = lgval/(2^32);

and reassembling the 64bit value I tried like:
CPU: PowerPC e500v2 
lgval= ((uint64)int[0]) | (((uint64)int[1])>>32);

mind shift to right since we're on big endian. For some reason I do not get the correct value at the end, why not? What am I doing wrong here?

A:

The ^ operator is xor, not power.
The way you want to do this is probably:
uint32_t split[2];
uint64_t lgval;

/* ... */

split[0] = lgval & 0xffffffff;
split[1] = lgval >> 32;

/* code to operate on your 32-bit array elements goes here */

lgval = ((uint64_t)split[1] << 32) | (uint64_t)(split[0]);

As Raymond Chen has mentioned, endianness is about storage. In this case, you only need to consider endianness if you want to access the bytes in your split-32-bit-int as a single 64-bit value. This probably isn't a good idea anyway.

