I compiled this code using Visual Studio 2010 (cl.exe /W4) as a C file:
cl.exe /W4
int main( int argc, char *argv[] ) { unsigned __int64 a = 0x00000000
Use this to avoid the sign extension:
unsigned __int64 a = 0x00000000FFFFFFFFLL;
Note the L on the end. Without this it is interpreted as a 32-bit signed number (-1) and then cast.