本文整理汇总了C++中Bound::is_ge方法的典型用法代码示例。如果您正苦于以下问题:C++ Bound::is_ge方法的具体用法?C++ Bound::is_ge怎么用?C++ Bound::is_ge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bound
的用法示例。
在下文中一共展示了Bound::is_ge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trim_to
// Trim arg1 to within bounds arg2 & arg3; should have arg2 <= arg3.
Integer trim_to(const Integer &i, const Bound &lo, const Bound &hi)
{
assert(lo.is_infinite() || hi.is_infinite() || lo.value() <= hi.value());
if (!lo.is_le(i))
return lo.value();
else if (!hi.is_ge(i))
return hi.value();
else
return i;
}
示例2: trim_values
// Trim all values in vector to be between LOW and HIGH, inclusive.
// We should have LOW <= 0, HIGH >= 0.
void BiVector::trim_values(const Bound &low, const Bound &high)
{
assert(low.is_le(0) && high.is_ge(0));
for (std::map<Integer, Integer>::iterator i = contents.begin();
i != contents.end(); i++)
{
if (!low.is_infinite() && i->second < low.value())
i->second = low.value();
if (!high.is_infinite() && i->second > high.value())
i->second = high.value();
}
}
示例3: remap_tape_difficult
//
// Try to remap a tape position to the specified range. Return FALSE if we
// must abort, TRUE o.w.
//
//
// In the event of one bound being wraparound and the other being undefined,
// tape operations will have been combined and optimization will have been
// done, so tape references may come either from the future or the
// past of the BF program. This fact means that we must treat the
// tape as wraparound in both directions.
//
bool remap_tape_difficult(Integer *p_i, EndType e_lo, const Bound &lo,
EndType e_hi, const Bound &hi)
{
if (!lo.is_le(*p_i))
{
switch
((e_hi == ET_wraparound && e_lo == ET_undefined) ? ET_wraparound : e_lo)
{
case ET_abort:
case ET_truncate:
case ET_undefined:
assert(!lo.is_infinite());
*p_i = lo.value();
if (e_lo == ET_abort || e_lo == ET_undefined)
return false;
break;
case ET_wraparound:
assert(!lo.is_infinite() && !hi.is_infinite());
*p_i = (*p_i - lo.value()) % (hi.value() - lo.value() + 1)
+ lo.value();
break;
}
}
else if (!hi.is_ge(*p_i))
{
switch
((e_lo == ET_wraparound && e_hi == ET_undefined) ? ET_wraparound : e_hi)
{
case ET_abort:
case ET_truncate:
case ET_undefined:
assert(!hi.is_infinite());
*p_i = hi.value();
if (e_hi == ET_abort || e_hi == ET_undefined)
return false;
break;
case ET_wraparound:
assert(!lo.is_infinite() && !hi.is_infinite());
*p_i = (*p_i - lo.value()) % (hi.value() - lo.value() + 1)
+ lo.value();
break;
}
} else
// Never called in this case
assert(0);
return true;
}
示例4: is_within
// See if arg1 is within bounds arg2 & arg3; should have arg2 <= arg3.
bool is_within(const Integer &i, const Bound &lo, const Bound &hi)
{
assert(lo.is_infinite() || hi.is_infinite() || lo.value() <= hi.value());
return lo.is_le(i) && hi.is_ge(i);
}