本文整理汇总了C++中Offsets::off方法的典型用法代码示例。如果您正苦于以下问题:C++ Offsets::off方法的具体用法?C++ Offsets::off怎么用?C++ Offsets::off使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Offsets
的用法示例。
在下文中一共展示了Offsets::off方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
varcmp_offsets(const void *i1, const void *i2)
{
if (offsets.off(*((Ident *) i1)) < offsets.off(*((Ident *) i2)))
return -1;
else if (offsets.off(*((Ident *) i1)) > offsets.off(*((Ident *) i2)))
return 1;
else
return 0;
}
示例2: qsort
void
Signature::make(IdentList &idents)
{
size = idents.size();
int *tab1 = new int[size];
int *tab2 = new int[size];
IdentList::iterator i;
unsigned int x,y,s;
for (i = idents.begin(), x = 0;
i != idents.end(); i++, x++)
tab1[x] = tab2[x] = offsets.off(*i);
qsort((int *) tab2, size, sizeof(int), sortcmp);
sign = new int[size];
hashvalue = 0;
for (x = 0; x < size; x++) {
for (y = 0, s = 0; tab2[y] != tab1[x]; y++)
if (y < size && tab2[y] != tab2[y+1])
s++;
sign[x] = s;
hashvalue = hashvalue*x+sign[x];
}
delete[] tab1;
delete[] tab2;
}
示例3: invariant
void
st_dfa_replace_indices(DFA *a, IdentList *newvars, IdentList *oldvars,
bool offnew, bool offold)
{
if (newvars && oldvars && newvars != oldvars) {
invariant(newvars->size() == oldvars->size());
int *indexmap = new int[offsets.maxOffset()];
IdentList::iterator i, j;
bool dif = false;
for(i = newvars->begin(), j = oldvars->begin();
j != oldvars->end(); i++, j++) {
int theold = offold ? offsets.off(*j) : *j;
int thenew = offnew ? offsets.off(*i) : *i;
indexmap[theold] = thenew;
if (theold != thenew)
dif = true;
}
if (dif) {
Timer temp;
if (options.time) {
timer_replace_indices.start();
if (options.statistics)
temp.start();
}
if (options.statistics)
cout << "Replacing indices\n";
dfaReplaceIndices(a, indexmap);
num_replaces++;
if (options.time) {
timer_replace_indices.stop();
if (options.statistics) {
temp.stop();
cout << " Time: ";
temp.print();
}
}
}
delete[] indexmap;
if (options.intermediate)
dfaPrintVerbose(a);
}
/*#warning update_largest(a);*/
}
示例4: invariant
void
st_gta_replace_indices(GTA *g, IdentList *newvars, IdentList *oldvars,
bool offnew, bool offold)
{
if (newvars && oldvars && newvars != oldvars) {
invariant(newvars->size() == oldvars->size());
unsigned *indexmap = new unsigned[offsets.maxOffset()];
IdentList::iterator i, j;
bool dif = false;
for(i = newvars->begin(), j = oldvars->begin();
j != oldvars->end(); i++, j++) {
int theold = offold ? offsets.off(*j) : *j;
int thenew = offnew ? offsets.off(*i) : *i;
indexmap[theold] = thenew;
if (theold != thenew)
dif = true;
}
if (dif) {
Timer temp;
if (options.time) {
timer_replace_indices.start();
if (options.statistics)
temp.start();
}
if (options.statistics)
cout << "Replacing indices\n";
gtaReplaceIndices(g, indexmap);
num_replaces++;
if (options.time) {
timer_replace_indices.stop();
if (options.statistics) {
temp.stop();
cout << " Time: ";
temp.print();
}
}
}
delete[] indexmap;
}
update_largest(g);
}
示例5: dfaAllPos
DFA*
st_dfa_allpos(DFA *dfa, Ident i)
{
DFA *t1, *t2;
t1 = st_dfa_minimization(st_dfa_product(dfa,
dfaAllPos(offsets.off(i)),
dfaAND,
dummyPos));
t2 = st_dfa_minimization(st_dfa_project(t1,
i,
dummyPos, false));
/*#warning update_largest(t2);*/
return t2;
}
示例6: stateSpaces
GTA *
st_gta_allpos(GTA *gta, Ident i)
{
GTA *t1, *t2;
IdentList *u = symbolTable.allRealUnivs();
SSSet set = stateSpaces(u);
delete u;
t1 = st_gta_minimization(st_gta_product(gta,
gtaAllPos(offsets.off(i), set),
gtaAND,
dummyPos));
t2 = st_gta_minimization(st_gta_project(t1,
i,
dummyPos, false));
update_largest(t2);
return t2;
}
示例7: gtaQuotientAndProject
GTA *
st_gta_project(GTA *g, Ident i, Pos &p, bool quotient)
{
Timer temp;
if (options.time) {
timer_project.start();
if (options.statistics)
temp.start();
}
if (options.statistics) {
cout << "Right-quotient\n" << "Projecting #" << i;
p.printsource();
cout << "\n ";
print_stat(g);
cout << " -> ";
cout.flush();
}
codeTable->begin();
GTA *result = gtaQuotientAndProject(g, offsets.off(i), quotient);
codeTable->done();
num_projections++;
num_right_quotients++;
if (options.statistics) {
print_stat(result);
cout << "\n";
}
if (options.time) {
timer_project.stop();
if (options.statistics) {
temp.stop();
cout << " Time: ";
temp.print();
}
}
gtaFree(g);
update_largest(result);
return result;
}
示例8: if
//.........这里部分代码省略.........
assertionCode = andList(assertionCode, getRestriction(*i, NULL));
// Restrict assertion if not trivial
if (assertionCode.code->kind != cTrue)
assertionCode = codeTable->insert
(new Code_Restrict(assertionCode, assertionCode.code->pos));
// Add assertion to main formula and to all verify formulas
for (Deque<VarCode>::iterator i = verifyCode.begin();
i != verifyCode.end(); i++) {
assertionCode.code->refs++;
*i = andList(*i, VarCode(copy(assertionCode.vars), assertionCode.code));
}
formulaCode = andList(formulaCode, assertionCode);
timer_gencode.stop();
if (options.printProgress) {
codeTable->print_statistics();
/* if (options.dump && options.statistics)
codeTable->print_sizes(); */
cout << "Time: ";
timer_gencode.print();
}
///////// REORDER BDD OFFSETS ////////////////////////////////////////////
if (options.reorder >= 1) {
Timer timer_reorder;
timer_reorder.start();
if (options.printProgress)
cout << "\nREORDERING\n";
// reorder using heuristics
offsets.reorder();
// regenerate DAG in new codetable
CodeTable *oldCodeTable = codeTable, *newCodeTable = new CodeTable;
IdentList emptylist;
codeTable = newCodeTable;
regenerate = true; // force making new nodes
VarCode newcode = formulaCode.substCopy(&emptylist, &emptylist);
Deque<VarCode> newverifycode;
for (Deque<VarCode>::iterator i = verifyCode.begin();
i != verifyCode.end(); i++)
newverifycode.push_back((*i).substCopy(&emptylist, &emptylist));
codeTable->clearSCTable();
regenerate = false;
codeTable = oldCodeTable;
formulaCode.remove();
for (Deque<VarCode>::iterator i = verifyCode.begin();
i != verifyCode.end(); i++)
(*i).remove();
formulaCode = newcode;
verifyCode.reset();
for (Deque<VarCode>::iterator i = newverifycode.begin();
i != newverifycode.end(); i++)
verifyCode.push_back(*i);
delete oldCodeTable;
codeTable = newCodeTable;
if (options.printProgress) {
codeTable->print_statistics2();
cout << "Time: ";
timer_reorder.print();
}
}
示例9: dfaRightQuotient
DFA*
st_dfa_project(DFA *a, Ident i, Pos &p, bool quotient)
{
Timer temp1, temp2;
int a_ns = a->ns;
if (options.time) {
timer_right_quotient.start();
if (options.statistics)
temp1.start();
}
if (options.statistics)
cout << "Right-quotient\n";
if (quotient) {
codeTable->begin();
dfaRightQuotient(a, offsets.off(i));
codeTable->done();
num_right_quotients++;
}
if (options.time) {
timer_right_quotient.stop();
if (options.statistics) {
temp1.stop();
cout << " Time: ";
temp1.print();
}
}
if (options.time) {
timer_project.start();
if (options.statistics)
temp2.start();
}
if (options.statistics) {
cout << "Projecting #" << i;
p.printsource();
cout << "\n (" << a_ns << "," << bdd_size(a->bddm) << ") -> ";
cout.flush();
}
codeTable->begin();
DFA *result = dfaProject(a, offsets.off(i));
codeTable->done();
num_projections++;
if (options.statistics)
cout << "(" << result->ns << "," << bdd_size(result->bddm) << ")\n";
if (options.time) {
timer_project.stop();
if (options.statistics) {
temp2.stop();
cout << " Time: ";
temp2.print();
}
}
dfaFree(a);
/*#warning update_largest(result);*/
return result;
}