Skip to content

Instantly share code, notes, and snippets.

@alsamitech
Created July 2, 2021 15:28
Show Gist options
  • Select an option

  • Save alsamitech/b9c0eeb9fd3b3b1a01c5bb08632ddb11 to your computer and use it in GitHub Desktop.

Select an option

Save alsamitech/b9c0eeb9fd3b3b1a01c5bb08632ddb11 to your computer and use it in GitHub Desktop.
#define BIT_0 1
#define BIT_1 2
#define BIT_2 4
#define BIT_3 8
#define BIT_4 16
#define BIT_5 32
#define BIT_6 64
#define BIT_7 128
void bitchar(char* s, char c){
for(unsigned char i=0;i<8;i++){
s[i] = c & 0x80 ? '1' : '0';
c <<= 1;
}
s[8]=0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment