Hello,
'gcc' complains about this code:
#define TWI_MREAD ((unsigned int) 0x1 << 12)
#define TWI_IADRSZ_1_BYTE ((unsigned int) 0x1 << 8)
int write_single(int SlaveAddr, int IntAddrSize)
{
unsigned int mmr = SlaveAddr | IntAddrSize & ~TWI_MREAD;
...
}
....
write_single(0x22, TWI_IADRSZ_1_BYTE);
....
warning: suggest parentheses around arithmetic in operand of |
Certainly priority of '&' operation is higher then '|'. Should I put
parentheses like this:
SlaveAddr | (IntAddrSize & ~TWI_MREAD)
or
(SlaveAddr | IntAddrSize) & ~TWI_MREAD
It seems it has just logical meaning (and convenience of reading the code),
but result is same. Or it might have any side effects?
Thanks in advance.
With best regards, Roman Mashak. E-mail: mr*@tusur.ru