Created
January 3, 2015 15:00
-
-
Save HaiyangXu/596833e6aa77e3e5a140 to your computer and use it in GitHub Desktop.
This file contains 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 BITSPERWORD sizeof(int)*8 | |
#define SHIFT 5 | |
#define MASK 0x1f | |
#define N 10000000 | |
int a[1+N/BITSPERWORD]; | |
void set(int i){ | |
a[i/BITSPERWORD]|=(1<<(i%BITSPERWORD)); | |
} | |
void clr(int i){ | |
a[i/BITSPERWORD]&=~(1<<(i%BITSPERWORD)); | |
} | |
int test(int i){ | |
return a[i/BITSPERWORD]&(1<<(i%BITSPERWORD)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment