Skip to content

Instantly share code, notes, and snippets.

@aneury1
Last active November 20, 2019 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aneury1/a581d04e9fee5122c0a7ac7fa871335f to your computer and use it in GitHub Desktop.
Save aneury1/a581d04e9fee5122c0a7ac7fa871335f to your computer and use it in GitHub Desktop.
#include <iostream>
...
void fn(){
char ch = 0xDF;
for (int i =8; i > 0; i--)
{
std::cout <<((ch&(1<<i))?1:0);
}
char v = 2;
for (int i = 0; i < 8; i++)
std::cout << ((v >> i)&0x1)<<"\n";///test
char v64='\0';
v64 |= (1 << 3);///set
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment