by raxxorraxor · 4y ago · 0 comments
#define CLEARBIT(a,p) = ((a) &= ~(1 << (p)))
might not work correctly if your datatype is something "exotic" like a long. An inlined function might be the better choice.Otherwise you would need to define specific macros again:
#define CLEARBITLONG(a,p) = ((a) &= ~(1L << (p)))
These bugs can steal hours of your time, especially on embedded systems where debugging is less accessible. #define CLEARBIT(a,p) = ((a) &= ~((typeof(a))1 << (p)))