We found that some strange values are being created, a small test case below. It prints "FFFFFFFFF9A64C2A". The meaning of the unsigned long long seems to have been expanded. But why? All of the types below are unsigned, and what does a character extension do? The expected result will be "F9A64C2A".
#include <stdio.h>
int main(int argc,char *argv[])
{
unsigned char a[] = {42,76,166,249};
unsigned long long ts;
ts = a[0] | a[1] << 8U | a[2] << 16U | a[3] << 24U;
printf("%llX\n",ts);
return 0;
}
source
share