本文整理汇总了C++中BitSet函数的典型用法代码示例。如果您正苦于以下问题:C++ BitSet函数的具体用法?C++ BitSet怎么用?C++ BitSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BitSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadImageDesc
static int ReadImageDesc (MG_RWops *area, IMAGEDESC* ImageDesc, GIFSCREEN* GifScreen)
{
unsigned char buf[16];
if (!ReadOK (area, buf, 9)) {
_MG_PRINTF ("EX_CTRL>GIF89a: bad image size\n");
return -1;
}
ImageDesc->Top = LM_to_uint (buf[0], buf[1]);
ImageDesc->Left = LM_to_uint (buf[2], buf[3]);
ImageDesc->Width = LM_to_uint (buf[4], buf[5]);
ImageDesc->Height = LM_to_uint (buf[6], buf[7]);
ImageDesc->haveColorMap = BitSet (buf[8], LOCALCOLORMAP);
ImageDesc->bitPixel = 1 << ((buf[8] & 0x07) + 1);
ImageDesc->interlace = BitSet(buf[8], INTERLACE);
if (ImageDesc->haveColorMap) {
_MG_PRINTF ("EX_CTRL>GIF89a: have local colormap\n");
if (ReadColorMap (area, ImageDesc->bitPixel, ImageDesc->ColorMap) < 0) {
_MG_PRINTF ("EX_CTRL>GIF89a: bad local colormap\n");
return -1;
}
} else {
memcpy (ImageDesc->ColorMap, GifScreen->ColorMap, MAXCOLORMAPSIZE*sizeof (RGB));
}
return 0;
}
示例2: BitsSet
/*
* Set the bit string.
* Set the width bits from the position of specified bit.
*/
EXPORT void BitsSet( VP base, W offset, W width )
{
UB *bp;
INT n;
n = offset / TSD_BST_N_8;
bp = (UB*)base + n;
n = (W)((UW)offset & TSD_BST_MSK_7);
if ( n > 0 ) {
for ( ; n < TSD_BST_N_8; ++n ) {
if ( --width < 0 ) {
return;
}
BitSet(bp, (UW)n);
}
bp++;
}
n = width / TSD_BST_N_8;
if ( n > 0 ) {
memset(bp, TSD_BST_VAL_0XFF, (size_t)n);
}
bp += n;
width -= n * TSD_BST_N_8;
for ( n = 0; n < width; ++n ) {
BitSet(bp, (UW)n);
}
}
示例3: if
BitSet* ChainedFilter::bits( IndexReader* reader, int logic )
{
BitSet* bts = NULL;
Filter** filter = filters;
// see discussion at top of file
if( *filter ) {
BitSet* tmp = (*filter)->bits( reader );
if ( (*filter)->shouldDeleteBitSet(tmp) ) //if we are supposed to delete this BitSet, then
bts = tmp; //we can safely call it our own
else if ( tmp == NULL ){
int32_t len = reader->maxDoc();
bts = _CLNEW BitSet( len ); //bitset returned null, which means match _all_
for (int32_t i=0;i<len;i++ )
bts->set(i);
}else{
bts = tmp->clone(); //else it is probably cached, so we need to copy it before using it.
}
filter++;
}
else
bts = _CLNEW BitSet( reader->maxDoc() );
while( *filter ) {
doChain( bts, reader, logic, *filter );
filter++;
}
return bts;
}
示例4: BitsSet
/*
* Set the bit string.
* Set the width bits from the position of specified bit.
*/
EXPORT void BitsSet( void *base, W offset, W width )
{
UB *bp;
INT n;
n = offset / 8;
bp = (UB*)base + n;
n = (W)((UW)offset & 7U);
if ( n > 0 ) {
for ( ; n < 8; ++n ) {
if ( --width < 0 ) {
return;
}
BitSet(bp, (UW)n);
}
bp++;
}
n = width / 8;
if ( n > 0 ) {
MEMSET(bp, 0xffU, (size_t)n);
}
bp += n;
width -= n * 8;
for ( n = 0; n < width; ++n ) {
BitSet(bp, (UW)n);
}
}
示例5: SetPopSub
//==================================================================================
void SetPopSub(U8 _pth, U8 _pos_x, U8 _pos_y, U8 _lngth, U8 _hght, U8 _main_mn_pos_crnt)
{
// _lngth = 0; //... temporal
// _hght = 0; //... temporal
CreateBoxPopFrame(_pth,BOX_POP_SB,_pos_x,_pos_y,_lngth,_hght);
// IfBitSet(_pth,PTH_X) SetPopSubOSD(PTH_X,_pos_x,_pos_y, _main_mn_pos_crnt);
// IfBitSet(_pth,PTH_Y) SetPopSubOSD(PTH_Y,_pos_x,_pos_y, _main_mn_pos_crnt);
if(BitSet(_pth,PTH_X)) SetPopSubOSD(PTH_X,_pos_x,_pos_y, _main_mn_pos_crnt);
if(BitSet(_pth,PTH_Y)) SetPopSubOSD(PTH_Y,_pos_x,_pos_y, _main_mn_pos_crnt);
}
示例6: SetPopMain
//==================================================================================
void SetPopMain(U8 _pth, U8 _pos_x, U8 _pos_y, U8 _lngth, U8 _hght)
{
// _lngth = 0; //... temporal
// _hght = 0; //... temporal
CreateBoxPopFrame(_pth,BOX_POP_MN,_pos_x,_pos_y,_lngth,_hght);
// IfBitSet(_pth,PTH_X) SetPopMainOSD(PTH_X,_pos_x,_pos_y);
// IfBitSet(_pth,PTH_Y) SetPopMainOSD(PTH_Y,_pos_x,_pos_y);
if(BitSet(_pth,PTH_X)) SetPopMainOSD(PTH_X,_pos_x,_pos_y);
if(BitSet(_pth,PTH_Y)) SetPopMainOSD(PTH_Y,_pos_x,_pos_y);
}
示例7: bitmanip
int bitmanip(int word)
{
printf("fresh %d\n",word);
word = BitSet(word, 2);
printf("set 2 %d\n",word);
word = BitSet(word, 7);
printf("set 7 %d\n",word);
word = BitClr(word, 3);
printf("clr 3 %d\n",word);
word = BitFlp(word, 9);
printf("flip 9 %d\n",word);
return word;
}
示例8: SetObjectVisible
void SetObjectVisible (ObjectRecHdl ObjectHdl, Boolean VisibleFlag)
{
short objectFlags;
objectFlags = (**ObjectHdl).objectFlags;
if (VisibleFlag)
BitSet (&objectFlags, kVisibleMask);
else
BitSet (&objectFlags, kVisibleMask);
(**ObjectHdl).objectFlags = objectFlags;
return;
}
示例9: DisableBox
//==================================================================================
// Box function description
//==================================================================================
//void SetBox3DEffect(U8 tgl_dim, U8 tgl_emp)
//{
// U8 r_box_mode;
//
// r_box_mode = ReadAsicByte(MASTER,DVC_PG2,REG_BOX_MODE);
// if(tgl_dim == ON) SetBit(r_box_mode,BOX_TYPE);
// else ClearBit(r_box_mode,BOX_TYPE);
// if(tgl_emp == ON) SetBit(r_box_mode,BOX_EMP);
// else ClearBit(r_box_mode,BOX_EMP);
// WriteAsicByte(MASTER,DVC_PG2,REG_BOX_MODE,r_box_mode);
//}
////==================================================================================
//void SetBoxPlaneCol(U8 _box_strt, U8 _box_end, U8 _col)
//{
// U8 _rdat_;
// U8 _t1_, _t2_;
//
// for(_t1_ = _box_strt ; _t1_ <= _box_end ; _t1_++){
// _rdat_ = ReadAsicByte(MASTER,DVC_PG2,REG_BOXCOL10+(_t1_>>1));
// _t2_ = (_t1_&0x01)<<2; //... _t2_ = 0 or _t2_ = 4
// _rdat_ = (_rdat_ & (0xf0>>_t2_))|_col<<_t2_;
// WriteAsicByte(MASTER,DVC_PG2,REG_BOXCOL10+(_t1_>>1),_rdat_);
// }
//}
////==================================================================================
//void SetBoxPlane(U8 _box_strt, U8 _box_end, U8 tgl_pln)
//{
// U8 _rdat_;
// U8 _t1_;
//
// for(_t1_ = _box_strt ; _t1_ <= _box_end ; _t1_++){
// _rdat_ = ReadAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_);
// if(tgl_pln == ON) SetBit(_rdat_,BOX_PLN_EN);
// else ClearBit(_rdat_,BOX_PLN_EN);
// WriteAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_,_rdat_);
// }
//}
////==================================================================================
//void EnableBox(U8 _pth, U8 _box_num)//U8 _box_strt, U8 _box_end)
//{
//// U8 _rdat_;
//// U8 _t1_=0;
////
//// for(_t1_ = _box_strt ; _t1_ <= _box_end ; _t1_++){
//// _rdat_ = ReadAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_);
//// ClearBit(_rdat_,BOX_EN_X|BOX_EN_Y);
//// WriteAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_,_pth|_rdat_);
//// }
//
// if(BitSet(_pth,PTH_X)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT0,BIT0);
// if(BitSet(_pth,PTH_Y)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT3,BIT3);
//}
////==================================================================================
void DisableBox(U8 _pth, U8 _box_num)//, U8 _box_strt, U8 _box_end)
{
// U8 _rdat_;
// U8 _t1_;
//
// for(_t1_ = _box_strt ; _t1_ <= _box_end ; _t1_++){
// _rdat_ = ReadAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_);
// WriteAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_,(~ _pth) & _rdat_);
// }
if(BitSet(_pth,PTH_X)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT1|BIT0,0x00);
if(BitSet(_pth,PTH_Y)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT4|BIT3,0x00);
}
示例10: SetBoxPln
//==================================================================================
void SetBoxPln(U8 _pth, U8 _box_num, U8 _tgl)//U8 _box_strt, U8 _box_end
{
// U8 _rdat_
// U8 _t1_=0
//
// for(_t1_ = _box_strt ; _t1_ <= _box_end ; _t1_++)
// _rdat_ = ReadAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_)
// ClearBit(_rdat_,BOX_EN_X|BOX_EN_Y)
// WriteAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_,_pth|_rdat_)
//
if(BitSet(_pth,PTH_X)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT0,_tgl);
if(BitSet(_pth,PTH_Y)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT3,_tgl<<3);
}
示例11: SetBoxMix
//==================================================================================
void SetBoxMix(U8 _pth, U8 _box_num, U8 _tgl)//U8 _box_strt, U8 _box_end, U8 tgl_ht)
{
// U8 _rdat_;
// U8 _t1_;
//
// for(_t1_ = _box_strt ; _t1_ <= _box_end ; _t1_++){
// _rdat_ = ReadAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_);
// if(tgl_ht == ON) SetBit(_rdat_,BOX_PLN_MIX);
// else ClearBit(_rdat_,BOX_PLN_MIX);
// WriteAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_,_rdat_);
// }
if(BitSet(_pth,PTH_X)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT2,_tgl<<2);
if(BitSet(_pth,PTH_Y)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT5,_tgl<<5);
}
示例12: LCD_NYB
//--------------------------------------------------------------------------------//
void LCD_NYB(unsigned char nyb,unsigned char type){
//SEND DATA LINE THE INFO
LCD_PORT->BSRRH |= 0x0F;
LCD_PORT->BSRRL |= (nyb & 0x0F);
if(type == CMD){
BitClr(LCD_RS); //COMMAND MODE
} else {
BitSet(LCD_RS); //CHARACTER/DATA MODE
}
BitSet(LCD_E); //ENABLE LCD DATA LINE
DelayMS(1); //SMALL DELAY
BitClr(LCD_E); //DISABLE LCD DATA LINE
}
示例13: SetBoxPos
//==================================================================================
void SetBoxPos(U8 _box_num, U16 _boxhl, U16 _boxvt)
{
U8 _rdat_;
_rdat_ = ReadAsicByte(MASTER,DVC_PG2,0x21+_box_num*6);
if(BitSet(_boxhl, BIT0)) SetBit(_rdat_, BIT3);
else ClearBit(_rdat_, BIT3);
if(BitSet(_boxvt, BIT0)) SetBit(_rdat_, BIT1);
else ClearBit(_rdat_, BIT1);
WriteAsicByte(MASTER,DVC_PG2,0x21+_box_num*6,_rdat_);
WriteAsicByte(MASTER,DVC_PG2,0x22+_box_num*6,(U8)(_boxhl>>1));
WriteAsicByte(MASTER,DVC_PG2,0x24+_box_num*6,(U8)(_boxvt>>1));
}
示例14: SetBoxBnd
//==================================================================================
void SetBoxBnd(U8 _pth, U8 _box_num, U8 _tgl)//U8 _box_strt, U8 _box_end, U8 boundary)
{ //... single box boundary is generated same as channel boundary structure.
//... that is, boxhl/boxvt is inside of box area, boxhw/boxvw is outside of box area.
// U8 _rdat_;
// U8 _t1_;
//
// for(_t1_ = _box_strt ; _t1_ <= _box_end ; _t1_++){
// _rdat_ = ReadAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_);
// ClearBit(_rdat_,(BOX_OBND|BOX_IBND));
// WriteAsicByte(MASTER,DVC_PG2,REG_BOXCTL+5*_t1_,_rdat_|boundary);
// }
if(BitSet(_pth,PTH_X)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT1,_tgl<<1);
if(BitSet(_pth,PTH_Y)) SetAsicFlgType(MASTER,DVC_PG2,0x20+_box_num*6,BIT4,_tgl<<4);
}
示例15: Enabled
// Fairness Checker implementation
FairnessChecker::FairnessChecker(const LTSFairSetRef& FairSet,
SystemIndexSet* SysIdxSet,
const vector<GCmdRef>& GuardedCommands,
LTSChecker* Checker)
: Enabled(false), Disabled(false), Executed(false),
FairSet(FairSet), NumInstances(FairSet->GetNumInstances()),
IsStrong(FairSet->GetFairnessType() == FairSetFairnessType::Strong),
SysIdxSet(SysIdxSet), ClassID(FairSet->GetClassID()),
GCmdsToRespondTo(NumInstances, BitSet(GuardedCommands.size(), false)),
GCmdIDsToRespondTo(NumInstances),
Checker(Checker),
EnabledPerInstance(NumInstances, false),
ExecutedPerInstance(NumInstances, false),
DisabledPerInstance(NumInstances, false),
SatisfiedInTrace(NumInstances, false)
{
for (u32 Instance = 0; Instance < NumInstances; ++Instance) {
const u32 NumGuardedCommands = GuardedCommands.size();
for (u32 i = 0; i < NumGuardedCommands; ++i) {
auto const& Cmd = GuardedCommands[i];
auto const& FairObjs = Cmd->GetFairnessObjsSatisfied();
for (auto const& FairObj : FairObjs) {
if (FairObj->GetFairnessSet() == FairSet &&
FairObj->GetInstanceNumber() == Instance) {
GCmdsToRespondTo[Instance].Set(i);
GCmdIDsToRespondTo[Instance].insert(i);
}
}
}
}
}