From 12487e14abe3489865350ec395e77e4473541d1a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 30 Apr 2018 09:14:23 -0700 Subject: [PATCH] Reduce extra loop comparison --- pcbnew/router/pns_line.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 99309a5c3c..293ef7aabb 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -799,9 +799,9 @@ bool LINE::HasLoops() const { for( int i = 0; i < PointCount(); i++ ) { - for( int j = 0; j < PointCount(); j++ ) + for( int j = i + 2; j < PointCount(); j++ ) { - if( ( std::abs( i - j ) > 1 ) && CPoint( i ) == CPoint( j ) ) + if( CPoint( i ) == CPoint( j ) ) return true; } } @@ -864,7 +864,9 @@ OPT_BOX2I LINE::ChangedArea( const LINE* aOther ) const i_start = i; break; } - } else { + } + else + { i_start = i; break; }