Created
January 3, 2015 15:00
-
-
Save hailangx/596833e6aa77e3e5a140 to your computer and use it in GitHub Desktop.
Revisions
-
HaiyangXu created this gist
Jan 3, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #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)); }