Skip to content

Instantly share code, notes, and snippets.

@rainbow23
Created October 29, 2016 09:45
Show Gist options
  • Save rainbow23/8b8a068358d78615bf46c5bd4985016a to your computer and use it in GitHub Desktop.
Save rainbow23/8b8a068358d78615bf46c5bd4985016a to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
for(int i =0; i < 4; i++){
printf("num:%d >> %d\n",i, (i>>1)&1);
/* log
00
01
10
11
num:0 >> 0
num:1 >> 0
num:2 >> 1
num:3 >> 1
*/
}
for(int i =0; i < 4; i++){
printf("num:%d %d\n",i, i&1);
/* log
00
01
10
11
num:0 0
num:1 1
num:2 0
num:3 1
*/
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment