求助手写 bitset
  • 板块学术版
  • 楼主linxuanrui
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/10/16 21:41
  • 上次更新2023/11/2 13:21:43
查看原帖
求助手写 bitset
857323
linxuanrui楼主2023/10/16 21:41

写挂了,不知道挂在哪里。

struct Bitset{
	unsigned long b[SIZE];
	void set(){memset(b,0xff,sizeof(b));}
	void set(int pos){b[pos >> 6] |= (1ull << (32 - (pos & 31)));}
	void reset(){memset(b,0,sizeof(b));}
	void reset(int pos){b[pos >> 6] &= ~(1ull << (32 - (pos & 31)));}
	bool test(int pos){return (b[pos >> 6] & (1ull << (32 - (pos & 31))));}
};
2023/10/16 21:41
加载中...