本文整理汇总了C++中Offsets::maxOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ Offsets::maxOffset方法的具体用法?C++ Offsets::maxOffset怎么用?C++ Offsets::maxOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Offsets
的用法示例。
在下文中一共展示了Offsets::maxOffset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);*/
}
示例2: 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);
}