I'm currently fixing a legacy bug in C code. In the process of fixing this bug, I stored an `unsigned int` into an `unsigned long long`. But to my surprise, math stopped working when I compiled this code on a 64 bit version of `GCC`. I discovered that the problem was that when I assigned a `long long` an int value, then I got a number that looked like `0x0000000012345678`, but on the 64-bit machine, that number became `0xFFFFFFFF12345678`.

Can someone explain to me or point me to some sort of spec or documentation on what is supposed to happen when storing a smaller data type in a larger one and perhaps what the appropriate pattern for doing this in C is?

**Update - Code Sample**

Here's what I'm doing:

```
// Results in 0xFFFFFFFFC0000000 in 64 bit gcc 4.1.2
// Results in 0x00000000C0000000 in 32 bit gcc 3.4.6
u_long foo = 3 * 1024 * 1024 * 1024;

```