I have compiler warning in code while setting 32nd bit. Code works but this warning annoys me.
Compiler is Keil C, processor is 32 bit ARM. Code is as following
PINSEL0 |= PINSEL_AD15;
where PINSEL0
is 32 bit register, defined as
#define PINSEL0 (*((volatile unsigned long *) 0xE002C000))
and PINSEL_AD15
is defined like:
#define PINSEL_AD15 ((1<<30)|(1<<31))
The warning message I'm receiving is: integer operation result is out of range
The literal 1
is a signed integer, so when you shift by 31, you're going out of range. Try using an unsigned integer:
(1U << 31)