Created
September 12, 2017 11:08
-
-
Save PaulChana/7f610a863493a2e6447f128b5691b330 to your computer and use it in GitHub Desktop.
Set / Get individual bits in an int
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BitVal(data,y) ( (data>>y) & 1) /** Return Data.Y value **/ | |
#define SetBit(data,y) data |= (1 << y) /** Set Data.Y to 1 **/ | |
#define ClearBit(data,y) data &= ~(1 << y) /** Clear Data.Y to 0 **/ | |
#define TogleBit(data,y) (data ^=BitVal(y)) /** Togle Data.Y value **/ | |
#define Togle(data) (data =~data ) /** Togle Data value **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment