コード例 #1
0
int main()
{
	bitcheck( 64 );
	bitcheck( 108 ); // 64 + 32 + 8 + 4
	bitcheck( 132 ); // 128 + 4
	bitcheck( 323 ); // (256) + 64 + 2 + 1

	printf("0x12345678 & 0xff = %x\n", (0x12345678 & 0xff) );

	std::vector < uchar > uc_vec(4);
	uc_vec[0] = 0x87;
	uc_vec[1] = 0x65;
	uc_vec[2] = 0x43;
	uc_vec[3] = 0x21;
	printf("gint(uc_vec, 1, 2) = %x\n", gint(uc_vec, 1, 2) );

	return 1;
}
コード例 #2
0
ファイル: frame_pool.C プロジェクト: 14nguyenh/CSCE-410
unsigned long FramePool::get_frame(){
  for(int i = 0; i < pool_size/32; i++){ //32 bits in an int
      for(int j = 0; j < 32; j++){ //check the row to see which is free
        if(!bitcheck(freemap[i], j)){ //found free
          setbit(freemap[i], j);
          return (start_frame + i * 32 + j) * 4096;
        }
      }
  }
  return 0;
}