本文整理汇总了C++中Bits::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Bits::size方法的具体用法?C++ Bits::size怎么用?C++ Bits::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bits
的用法示例。
在下文中一共展示了Bits::size方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Ticket_ATTLC::Validate(Bits& b)
{
unsigned int count = 0;
while (b[count])
count++;
while (count >= b.size())
b.size(b.size() + bits_increment);
num = count;
b.set(num);
}
示例2: makeVariable
void EagerBitblaster::makeVariable(TNode var, Bits& bits) {
Assert(bits.size() == 0);
for (unsigned i = 0; i < utils::getSize(var); ++i) {
bits.push_back(utils::mkBitOf(var, i));
}
d_variables.insert(var);
}
示例3:
void
print_bitset(Bits b, size_t size = 0)
{
if (size == 0)
size = b.size();
for (size_t pos = b.find_first(); pos < size && pos != string::npos; pos = b.find_next(pos))
{
std::cout << pos << ", ";
}
std::cout << std::endl;
}
示例4: getVarValue
/**
* Returns the value a is currently assigned to in the SAT solver
* or null if the value is completely unassigned.
*
* @param a
* @param fullModel whether to create a "full model," i.e., add
* constants to equivalence classes that don't already have them
*
* @return
*/
Node TLazyBitblaster::getVarValue(TNode a, bool fullModel) {
if (!hasBBTerm(a)) {
Assert(isSharedTerm(a));
return Node();
}
Bits bits;
getBBTerm(a, bits);
Integer value(0);
for (int i = bits.size() -1; i >= 0; --i) {
prop::SatValue bit_value;
if (d_cnfStream->hasLiteral(bits[i])) {
prop::SatLiteral bit = d_cnfStream->getLiteral(bits[i]);
bit_value = d_satSolver->value(bit);
Assert (bit_value != prop::SAT_VALUE_UNKNOWN);
} else {
// the bit is unconstrainted so we can give it an arbitrary value
bit_value = prop::SAT_VALUE_FALSE;
}
Integer bit_int = bit_value == prop::SAT_VALUE_TRUE ? Integer(1) : Integer(0);
value = value * 2 + bit_int;
}
return utils::mkConst(BitVector(bits.size(), value));
}
示例5: __hashbits
void __hashbits(hash_t *hash, void *data, uint32_t size) {
// compute hash of data.
Bits bits(size * 8);
ByteArrayToBits(data, size, bits);
Bits hashBits = _hasher->hash(bits);
for (uint32_t i = 0; i < hashBits.size() / 8; i++) {
uint8_t* chunk = &(((uint8_t*)hash)[i]);
*chunk = 0;
for (uint32_t j = 0; j < 8; j++) {
*chunk |= (hashBits[DB_HASH_NUM_BITS - (i * 8 + j) - 1] << j);
}
}
}
示例6: bbTerm
void EagerBitblaster::bbTerm(TNode node, Bits& bits) {
if (hasBBTerm(node)) {
getBBTerm(node, bits);
return;
}
d_bv->spendResource(options::bitblastStep());
Debug("bitvector-bitblast") << "Bitblasting node " << node <<"\n";
d_termBBStrategies[node.getKind()] (node, bits, this);
Assert (bits.size() == utils::getSize(node));
storeBBTerm(node, bits);
}
示例7: getModelFromSatSolver
/**
* Returns the value a is currently assigned to in the SAT solver
* or null if the value is completely unassigned.
*
* @param a
* @param fullModel whether to create a "full model," i.e., add
* constants to equivalence classes that don't already have them
*
* @return
*/
Node EagerBitblaster::getModelFromSatSolver(TNode a, bool fullModel) {
if (!hasBBTerm(a)) {
return fullModel? utils::mkConst(utils::getSize(a), 0u) : Node();
}
Bits bits;
getBBTerm(a, bits);
Integer value(0);
for (int i = bits.size() -1; i >= 0; --i) {
prop::SatValue bit_value;
if (d_cnfStream->hasLiteral(bits[i])) {
prop::SatLiteral bit = d_cnfStream->getLiteral(bits[i]);
bit_value = d_satSolver->value(bit);
Assert (bit_value != prop::SAT_VALUE_UNKNOWN);
} else {
if (!fullModel) return Node();
// unconstrained bits default to false
bit_value = prop::SAT_VALUE_FALSE;
}
Integer bit_int = bit_value == prop::SAT_VALUE_TRUE ? Integer(1) : Integer(0);
value = value * 2 + bit_int;
}
return utils::mkConst(BitVector(bits.size(), value));
}
示例8: modOut
Signal
BluetoothTransmitter::modulate(const Bits& input, double df) {
Signal modOut(Ns * input.size());
int offset = 0;
double phase=getPhase();
for (int i=0; i<input.size(); ++i) {
for(int j=0; j<Ns; ++j) {
double tt=twopi*df*(j+Ns*i)/((double)Ns);
if (tt>twopi) { tt=fmod(tt,twopi); }
double state = qsign(input[i])*s_qcoef[j] +
qsign(m_prev)*s_qcoef[j+Ns] + phase;
modOut[offset+j] = exp(Sample(0.0,twopi* (m_hf * state)+tt));
} // end j
// Update phase and previous bit value
phase += (m_prev ? -0.5 : 0.5);
m_prev = input[i];
offset += Ns;
} // end i
setPhase(phase);
return modOut;
}
示例9: bbTerm
void TLazyBitblaster::bbTerm(TNode node, Bits& bits) {
if (hasBBTerm(node)) {
getBBTerm(node, bits);
return;
}
Debug("bitvector-bitblast") << "Bitblasting node " << node <<"\n";
++d_statistics.d_numTerms;
d_termBBStrategies[node.getKind()] (node, bits,this);
Assert (bits.size() == utils::getSize(node));
storeBBTerm(node, bits);
}
示例10: hasValue
bool TLazyBitblaster::hasValue(TNode a) {
Assert (hasBBTerm(a));
Bits bits;
getBBTerm(a, bits);
for (int i = bits.size() -1; i >= 0; --i) {
prop::SatValue bit_value;
if (d_cnfStream->hasLiteral(bits[i])) {
prop::SatLiteral bit = d_cnfStream->getLiteral(bits[i]);
bit_value = d_satSolver->value(bit);
if (bit_value == prop::SAT_VALUE_UNKNOWN)
return false;
} else {
return false;
}
}
return true;
}