Macros to set and clear bits

Posted by volting on Stack Overflow See other posts from Stack Overflow or by volting
Published on 2010-06-04T23:32:23Z Indexed on 2010/06/05 13:02 UTC
Read the original article Hit count: 244

Filed under:
|
|
|
|

Im trying to write a few simple macros to simplify the task of setting and clearing bits which should be a simple task however I cant seem to get them to work correctly.

#define SET_BIT(p,n) ((p) |= (1 << (n)))
#define CLR_BIT(p,n) ((p) &= (~(1) << (n)))

© Stack Overflow or respective owner

Related posts about c

    Related posts about embedded