1. Your uint8_t would get promoted to a 32-bit int
2. Your int would get shifted, getting a 1 in the signing bit
3. The result would get stored in a uint32_t when being casted
Now I don't know how uint64_t works on a 32-bit machine, I'd have to compile the C code with -m32 to see.
EDIT: just tested and you're right, it's still a problem on 32-bit machines.
1. Your uint8_t would get promoted to a 32-bit int
2. Your int would get shifted, getting a 1 in the signing bit
3. The result would get stored in a uint32_t when being casted
Now I don't know how uint64_t works on a 32-bit machine, I'd have to compile the C code with -m32 to see.
EDIT: just tested and you're right, it's still a problem on 32-bit machines.