当前位置: 首页>>代码示例>>C++>>正文


C++ BitSet类代码示例

本文整理汇总了C++中BitSet的典型用法代码示例。如果您正苦于以下问题:C++ BitSet类的具体用法?C++ BitSet怎么用?C++ BitSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BitSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BitSet

/*
 * ??? This function really categorizes the lblock "line"... ???
 * Annotates the "line" with ALWAYSMISS/ALWAYSHIT/FIRSTMISS/FIRSTHIT
 * In the case of FIRSTMISS, also annotate with the loop-header of the most inner loop.
 */
void CATBuilder::worst(LBlock *line , ContextTree *node , LBlockSet *idset, int dec){
	int number = idset->count();
	BasicBlock *bb = line->bb();
	LBlock *cacheline;
	BitSet *in = new BitSet(number);


	in = IN(bb);

	//int count = 0;
	bool nonconflitdetected = false;
	bool continu = false;
	unsigned long tagcachline,tagline;

	//test if it's the lbloc which find in the same memory block

	/*
	 * If the IN(line) = {LB} and cacheblock(line)==cacheblock(LB), then
	 * nonconflict (Always Hit)
	 */
	if (in->count() == 1){
		for (int i=0;i < number;i++){
		if (in->contains(i)){
			cacheline = idset->lblock(i);
			tagcachline = ((unsigned long)cacheline->address()) >> dec;
			unsigned long tagline = ((unsigned long)line->address()) >> dec;
				if (tagcachline == tagline )
					nonconflitdetected = true;
			}
		}
	}
开发者ID:alexjordan,项目名称:otawa,代码行数:36,代码来源:cat_CATBuilder.cpp

示例2: 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;
}
开发者ID:Afreeca,项目名称:qt,代码行数:31,代码来源:ChainedFilter.cpp

示例3: updateCopyFromBitSet

void PVCopy::initCopy(
    PVStructure &copyPVStructure, BitSet &bitSet, bool lockRecord)
{
    bitSet.clear();
    bitSet.set(0);
    updateCopyFromBitSet(copyPVStructure,bitSet,lockRecord);
}
开发者ID:epics-base,项目名称:pvIOCCPP,代码行数:7,代码来源:pvCopy.cpp

示例4: getAlts

BitSet ATNConfigSet::getAlts() {
  BitSet alts;
  for (ATNConfig config : configs) {
    alts.set(config.alt);
  }
  return alts;
}
开发者ID:RainerBosch,项目名称:antlr4,代码行数:7,代码来源:ATNConfigSet.cpp

示例5: propagate_no_ub

/*
 * Restricted propagation procedure. Used when a direction is solved, but no new q-intersection is found.
 * Same as propagate, except that upper bounds are not recorded (because we did not find a curr_qinter to work with).
 */
void propagate_no_ub(const Array<IntervalVector>& boxes, IntStack ***dirboxes, int dimension, bool left, IntervalVector& hull_qinter, vector<BitSet *>& nogoods) {
	
	unsigned int n = hull_qinter.size();
	unsigned int p = boxes.size();
	
	IntervalVector b(n);
	
	/* Create the new nogood */
	BitSet *newNogood = new BitSet(0,p-1,BitSet::empt);
	
	/* We iterate through the boxes to propagate bounds */
	/* This does not seem to be optimal ; maybe we should study directly the directions' lists ? */
	for (int i=0; i<p; i++) {
		b = boxes[i];
		
		/* Check if the box can be added to the new nogood */
		if ((left && (b[dimension].lb() < hull_qinter[dimension].lb())) || (!left && (b[dimension].ub() > hull_qinter[dimension].ub()))) {
			newNogood->add(i);	
		}
		
		/* Check if the box is strictly outside our current q-inter hull */
		if ((left && (b[dimension].ub() < hull_qinter[dimension].lb())) || (!left && (b[dimension].lb() > hull_qinter[dimension].ub()))) {
			for (int k=dimension+1; k<n; k++) {
				if (dirboxes[k][0]->contain(i)) dirboxes[k][0]->remove(i);
				if (dirboxes[k][1]->contain(i)) dirboxes[k][1]->remove(i);
			}
			
			continue;
		}
	}
	
	nogoods.push_back(newNogood);
}
开发者ID:jinxiaosa,项目名称:ibex-lib,代码行数:37,代码来源:ibex_QInter2.cpp

示例6: result

BitSet BitSet::operator+(const BitSet& that)
{
    BitSet result(*this);
    for (int i = 0; i < that.length(); ++i) {
        result.add(that.get(i));
    }
    return result;
}
开发者ID:vlad-shevchenko,项目名称:BitSet,代码行数:8,代码来源:bitset.cpp

示例7: bitset_get_list_here

// populates el (assumed to be pre-allocated adequately by caller)
// with list of members in bitset bs.
static SB_INLINE void bitset_get_list_here(BitSet& bs, uint32_t *el) {
    int j = 0;
    BitSet::iterator i;
    for(i = bs.begin(); i != bs.end(); i++) {
        el[j] = *i;
        j++;
    }
}
开发者ID:3a9LL,项目名称:panda,代码行数:10,代码来源:sparsebitset.cpp

示例8: bitset_iter

static SB_INLINE void bitset_iter(BitSet& bs, int (*app)(uint32_t e, void* stuff1), void* stuff2) {
    BitSet::iterator i;
    for(i = bs.begin(); i != bs.end(); i++) {
        if((app(*i, stuff2)) != 0) {
            break;
        }
    }
}
开发者ID:3a9LL,项目名称:panda,代码行数:8,代码来源:sparsebitset.cpp

示例9: BitSet

BitSet *
BitSet::New(unsigned int max)
{
    BitSet *result = new BitSet(max);
    if (!result->init())
        return NULL;
    return result;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:8,代码来源:BitSet.cpp

示例10: main

int main(int argc, char *argv[]) {
    int x = 63;
    BitSet a;
    a.insertIntoSet(x);
    a.deleteFromSet(x);
    cout << a.isInBitSet(x);
    
    return 0;
}
开发者ID:deepwaterooo,项目名称:cs120ta,代码行数:9,代码来源:tmp.cpp

示例11:

void BitVector<dim>::unslice(BitSet<dim> t,size_t new_size)
{
  BitSet<dim> result;
  for (typename BitSet<dim>::iterator it=t.begin(); it();
       d_data>>=1,++it)
    result.set(*it,d_data[0]);
  d_data=result;
  d_size=new_size;
}
开发者ID:jeffreyadams,项目名称:atlasofliegroups,代码行数:9,代码来源:bitvector.cpp

示例12:

BitSet BitSet::operator!()
{
    BitSet bs;
    for (int i = 0; i < this->bitLength; ++i) {
        bool bit = (*this)[i];
        bs.add(!bit);
    }
    return bs;
}
开发者ID:vlad-shevchenko,项目名称:BitSet,代码行数:9,代码来源:bitset.cpp

示例13: delta

Delta delta( const BitSet& bit,
             const Scalar& default_value ) {
    Delta u( bit.size(), 1 );
    for( uint i = 0; i < bit.size(); ++i ) {
        if( bit[i]) {
            u.insert( i, 0 ) = default_value;
        }
    }
    return u;
}
开发者ID:AGGA-IRIT,项目名称:Radium-Engine,代码行数:10,代码来源:Delta.cpp

示例14: cloneFrag

NFAFrag NFA::cloneFrag(const NFAFrag& frag)
{
	list<NFAState*> workList;
	BitSet visited;

	workList.push_back(frag.start);
	visited.set(frag.start->stateId);	

	map<NFAState*,NFAState*> old2new;
	typedef map<NFAState*,NFAState*>::iterator Old2NewIter;

	while(!workList.empty())
	{
		NFAState* cur_state=workList.front();workList.pop_front();

		for(map<int,NFAState*>::iterator it=cur_state->cedges.begin();it!=cur_state->cedges.end();++it)
		{
			NFAState* nextstate=0;
			
			Old2NewIter findit;
			if((findit=old2new.find(it->second))==old2new.end())
			{
				old2new[it->second]=nextstate=newState();
			}
			else
				nextstate=findit->second;

			cur_state->cedges[it->first]=nextstate;

			if(!visited[nextstate->stateId])
				workList.push_back(nextstate);
		}

		for(NFAStateArrIter it=cur_state->eedges.begin();it!=cur_state->eedges.end();++it)
		{
			NFAState* nextstate=0;

			Old2NewIter findit;
			if((findit=old2new.find(*it))==old2new.end())
			{
				old2new[*it]=nextstate=newState();
			}
			else
				nextstate=findit->second;

			patch(cur_state,nextstate);

			if(!visited[nextstate->stateId])
				workList.push_back(nextstate);
		}
	}

	NFAFrag ret(old2new[frag.start],old2new[frag.out]);
	return ret;
}
开发者ID:codedhead,项目名称:lex,代码行数:55,代码来源:NFA.cpp

示例15: dataChecked

	void ChunkManager::dataChecked(const BitSet & ok_chunks)
	{
		// go over all chunks at check each of them
		for (Uint32 i = 0;i < chunks.count();i++)
		{
			Chunk* c = chunks[i];
			if (ok_chunks.get(i) && !bitset.get(i))
			{
				// We think we do not hae a chunk, but we do have it
				bitset.set(i,true);
				todo.set(i,false);
				// the chunk must be on disk
				c->setStatus(Chunk::ON_DISK);
				tor.updateFilePercentage(i,bitset); 
			}
			else if (!ok_chunks.get(i) && bitset.get(i))
			{
				Out(SYS_DIO|LOG_IMPORTANT) << "Previously OK chunk " << i << " is corrupt !!!!!" << endl;
				// We think we have a chunk, but we don't
				bitset.set(i,false);
				todo.set(i,!only_seed_chunks.get(i) && !excluded_chunks.get(i));
				if (c->getStatus() == Chunk::ON_DISK)
				{
					c->setStatus(Chunk::NOT_DOWNLOADED);
					tor.updateFilePercentage(i,bitset);
				}
				else if (c->getStatus() == Chunk::MMAPPED || c->getStatus() == Chunk::BUFFERED)
				{
					resetChunk(i);
				}
				else
				{
					tor.updateFilePercentage(i,bitset);
				}
			}
		}
		recalc_chunks_left = true;
		try
		{
			saveIndexFile();
		}
		catch (bt::Error & err)
		{
			Out(SYS_DIO|LOG_DEBUG) << "Failed to save index file : " << err.toString() << endl;
		}
		catch (...)
		{
			Out(SYS_DIO|LOG_DEBUG) << "Failed to save index file : unkown exception" << endl;
		}
		chunksLeft();
		corrupted_count = 0;
	}
开发者ID:,项目名称:,代码行数:52,代码来源:


注:本文中的BitSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。