bitmap.c
来自「source code to compute the visibility po」· C语言 代码 · 共 50 行
C
50 行
/* Brian O'Connor * bitmap.h * macros that facilitate treating a 32-bit int as a 32-bit bitmap. */#include "bitmap.h"#include <assert.h>#include <stdio.h>int TestBit(Bitmap b, int i){ assert(i < BITMAP_SIZE); return( b & (1 << i) );}void SetBit(Bitmap& b, int i){ assert(i < BITMAP_SIZE); b = b | (1 << i);}void ClearBit(Bitmap& b, int i){ assert(i < BITMAP_SIZE); b = b & ( ~(1 << i) );}int MapIsClear(Bitmap b){ return( b == 0);}void PrintBitmap(Bitmap b){ int i; for( i = BITMAP_SIZE - 1; i >= 0; i-- ) { if( b & (1 << i) ) { printf("1"); } else printf("0"); } printf("\n");}Bitmap ZeroBitmap(void){ return( 0L );}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?