Commit 592f7372 authored by Paul's avatar Paul
Browse files

Formatting

parent 31291843
...@@ -7,23 +7,24 @@ ...@@ -7,23 +7,24 @@
namespace migraph { namespace migraph {
template<class Range, class Iterator> template <class Range, class Iterator>
std::ptrdiff_t bidistance(const Range& r, Iterator start, Iterator last) std::ptrdiff_t bidistance(const Range& r, Iterator start, Iterator last)
{ {
auto start_forward = start; auto start_forward = start;
auto start_backwards = start; auto start_backwards = start;
std::size_t n = 0; std::size_t n = 0;
while(start_forward != last and start_backwards != last) while(start_forward != last and start_backwards != last)
{ {
n++; n++;
if(start_forward != r.end()) start_forward++; if(start_forward != r.end())
if(start_backwards != r.begin()) start_backwards--; start_forward++;
if(start_backwards != r.begin())
start_backwards--;
} }
if(start_forward == last) if(start_forward == last)
return n; return n;
else else
return -n; return -n;
} }
void dead_code_elimination::apply(program& p) const void dead_code_elimination::apply(program& p) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment