We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I use below macro #define SFRX(Sfr,Msk) (Sfr=((Sfr & (~ ((Msk)>>8)) ) |(Msk))) to simply both Set and Reset specified bits in some register.
If I write SFRX ( MyReg , 0x0100 ) this macro clears bit 0. If I write SFRX ( MyReg , 0x0002 ) this macro set bit 1. If I write SFRX ( MyReg , 0x0102 ) this macro clears bit 0 and sets bit 1 in one go whithout affecting other bits.
Now I would like to use this macro for a 32-bits system: #define SREG(Reg,Msk) (Sfr=((Sfr & (~ ((Msk)>>32)) ) |(Msk)))
Although the compiler warns that shifting is too long it works fine. (main.c(56): warning: #63-D: shift count is too large)
My question is: how do I prevent this warning to occur?
Thanks
Henk