Skip to content

Instantly share code, notes, and snippets.

@sam016
Forked from leonid-ed/bits_operation.h
Created April 8, 2018 16:35
Show Gist options
  • Save sam016/09508973b7ddef754fb0ede81d673454 to your computer and use it in GitHub Desktop.
Save sam016/09508973b7ddef754fb0ede81d673454 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) ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment