Skip to content

Instantly share code, notes, and snippets.

@collindonnell
Created May 2, 2020 21:36
Show Gist options
  • Save collindonnell/860aa9784ef80ca56b0057fa96a49917 to your computer and use it in GitHub Desktop.
Save collindonnell/860aa9784ef80ca56b0057fa96a49917 to your computer and use it in GitHub Desktop.
#define bitread(value, bit) (((value) >> (bit)) & 0x01)
#define bitset(value, bit) ((value) |= (1UL << (bit)))
#define bitclear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitwrite(value, bit, bitvalue) (bitvalue ? bitset(value, bit) : bitclear(value, bit))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment