implementation of bitmap

来源:互联网 发布:windows执行perl脚本 编辑:程序博客网 时间:2024/06/06 02:02

#define shift 5
#define tail 0x1F
#define bitword 32
#define N 10000000
int a[1+N/bitword];

void Set(int i){
  a[i>>shift] |= 1<<(i&tail);
}

void Clr(int i){
  a[i>>shift] &= ~(1<<(i&tail));
}

int test(int i){
  return a[i>>shift] & 1<<(i&tail);
}
=============

<script type="text/javascript"><!--google_ad_client = "pub-4697687764463140";//龙思csdn博客之adsense, 创建于 07-12-11google_ad_slot = "9918311208";google_ad_width = 728; google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js "></script>

原创粉丝点击