I tried left-shifting a unsigned int by 24 like below,
__u8 buf;
__u32 u32_result = 0;
__u64 u64_result = 0;
buf=0xFF;
u32_result= (buf<<24);
u64_result= (buf<<24);
printf("sizeof(__u64):%lu, sizeof(__u32):%lu, sizeof(__u8):%lu,\n", sizeof(__u64), sizeof(__u32), sizeof(__u8));
printf("u32_result: %u MB\n", u32_result);
printf("u64_result: %llu MB\n", u64_result);
The execute result as below,
sizeof(__u64):8, sizeof(__u32):4, sizeof(__u8):1,
u32_result: 4278190080 MB
u64_result: 18446744073692774400 MB
And, I'm confusing about why the __u32 and __u64 have different result? Is anyone can help me to figure-out? Thank a lot!