#include <iostream>
namespace std;
3:
// 能表示42亿+的无符号整数
5:
//数组长度,0-40亿
const Bit32 thirtytwo=32;
8:
void createArray(Bit32 *&arr)
10: {
new Bit32[maxLen];
sizeof(arr));
13: }
14:
bool setBit(Bit32 *arr,Bit32 num)
16: {
if(((arr[num/thirtytwo])&(1<<(thirtytwo-num%thirtytwo-1)))==0)
18: {
19: arr[num/thirtytwo]|=1<<(thirtytwo-num%thirtytwo-1);
return true;
21: }
else
23: {
return false;
25: }
26: }
27:
int main()
29: {
30: Bit32 *s;
31: createArray(s);
if(!setBit(s,5))
33: {
<<endl;
35: }
if(!setBit(s,64))
37: {
<<endl;
39: }
if(!setBit(s,1))
41: {
<<endl;
43: }
44:
return 0;
46: }