Skip to content

Instantly share code, notes, and snippets.

@leonid-ed
Last active April 8, 2018 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leonid-ed/5684679 to your computer and use it in GitHub Desktop.
Save leonid-ed/5684679 to your computer and use it in GitHub Desktop.
Macros for bit's manipulation: get bit, set bit, reset bit.
#define GET_BIT(X,N) ( ( (X) >> (N) ) & 1 )
#define SET_BIT(X,N) ( (X) | (1 << (N) ) )
#define RST_BIT(X,N) ( (X) & ~(1 << (N) ) )
@leonid-ed
Copy link
Author

But to use mask of bits is a better way! =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment