It truncates the memory. This is shown by this program, which shows the binary representation of the long, and then the binary representation of the long cast to a smaller int:
#include <stdio.h>
void Print8Byte(unsigned long Value) {
for (unsigned char i = 0; i < 64; i++) {
union {
unsigned long Value;
unsigned First:1;
} Cast = {.Value = Value>>i};
putchar('0'+Cast.First);
}
putchar('\n');
}
int main(int argc, char *argv[]) {
unsigned long Num = 0x284884848; //Arbitrary Value
Print8Byte(Num);
Print8Byte((unsigned int)Num);
}
Result:
0001001000010010000100010010000101000000000000000000000000000000
0001001000010010000100010010000100000000000000000000000000000000