
28 Aug
2018
28 Aug
'18
10:14 a.m.
On Tue, Aug 28, 2018 at 5:06 AM Bin Meng bmeng.cn@gmail.com wrote:
On Mon, Aug 27, 2018 at 7:19 AM Eugeniu Rosca roscaeugeniu@gmail.com wrote:
-#define MSR_IA32_APICBASE_BASE (0xfffff<<12) +#define MSR_IA32_APICBASE_BASE (0xfffffUL << 12)
I don't understand why such warnings is emitted: "left shift of 1048575 by 12 places cannot be represented in type 'int'"
Because it can't.
1 << 30 (fine) 1 << 31 (UB!)
This is good explained in the C standard for ages.
Compilers don't complain this code and Linux kernel has the same definition here.
Someone suppressed those warnings. But they are valid.
--
With Best Regards,
Andy Shevchenko