simplify/src/InclusionNode.cxx
/* find a region among the regions that are covered by this node
   that contains line. Regions are stored in sorted order, so
   we can use binary search */
find a region among the regions that are covered by this node
that contains line. Regions are stored in sorted order, so
we can use binary search
find a region among the regions that are covered by this node that contains line . Regions are stored in sorted order so we can use binary search
Region* InclusionNode::FindRegion(int line)
{
  int size = m_regions.size();
  Region* ret = 0;
  Region* reg;
  int mid;
  int high = size - 1;
  int low = 0;
  while(low <= high)
    {
      mid = (high + low)/2;
      reg = m_regions[mid];
      if (reg->GetStart() > line)
	{
	  high = mid - 1;
	}
      else if (reg->GetEnd() < line)
	{
	  low = mid + 1;
	}
      else
	{
	  ret = reg;
	  break;
	}
    }
  return ret;
}
Region * InclusionNode :: FindRegion ( int line ) { int size = m_regions . size ( ) ; Region * ret = 0 ; Region * reg ; int mid ; int high = size - 1 ; int low = 0 ; while ( low <= high ) { mid = ( high + low ) / 2 ; reg = m_regions [ mid ] ; if ( reg -> GetStart ( ) > line ) { high = mid - 1 ; } else if ( reg -> GetEnd ( ) < line ) { low = mid + 1 ; } else { ret = reg ; break ; } } return ret ; }
find a region among the regions that are covered by this node
that contains line.
find a region among the regions that are covered by this node that contains line .