Pcbnew: fix potential bug in connections calculations (see Bug #909298 ).
This commit is contained in:
parent
1cb1e88ef4
commit
b7db108cd7
|
@ -1583,12 +1583,12 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
|
||||||
int idxmax = aPadList.size()-1;
|
int idxmax = aPadList.size()-1;
|
||||||
|
|
||||||
int delta = aPadList.size();
|
int delta = aPadList.size();
|
||||||
if( delta & 1 && delta > 1 )
|
|
||||||
delta += 1;
|
int idx = 0; // Starting index is the beginning of list
|
||||||
delta /= 2;
|
|
||||||
int idx = delta; // Starting index is the middle of list
|
|
||||||
while( delta )
|
while( delta )
|
||||||
{
|
{
|
||||||
|
// Calculate half size of remaining interval to test.
|
||||||
|
// Ensure the computed value is not truncated (too small)
|
||||||
if( (delta & 1) && ( delta > 1 ) )
|
if( (delta & 1) && ( delta > 1 ) )
|
||||||
delta++;
|
delta++;
|
||||||
delta /= 2;
|
delta /= 2;
|
||||||
|
|
|
@ -342,12 +342,12 @@ void CONNECTIONS::CollectItemsNearTo( std::vector<CONNECTED_POINT*>& aList,
|
||||||
int idxmax = m_candidates.size()-1;
|
int idxmax = m_candidates.size()-1;
|
||||||
|
|
||||||
int delta = m_candidates.size();
|
int delta = m_candidates.size();
|
||||||
if( delta & 1 && delta > 1 )
|
|
||||||
delta += 1;
|
int idx = 0; // Starting index is the beginning of list
|
||||||
delta /= 2;
|
|
||||||
int idx = delta; // Starting index is the middle of list
|
|
||||||
while( delta )
|
while( delta )
|
||||||
{
|
{
|
||||||
|
// Calculate half size of remaining interval to test.
|
||||||
|
// Ensure the computed value is not truncated (too small)
|
||||||
if( (delta & 1) && ( delta > 1 ) )
|
if( (delta & 1) && ( delta > 1 ) )
|
||||||
delta++;
|
delta++;
|
||||||
delta /= 2;
|
delta /= 2;
|
||||||
|
@ -530,12 +530,12 @@ int CONNECTIONS::searchEntryPointInCandidatesList( const wxPoint & aPoint)
|
||||||
int idxmax = m_candidates.size()-1;
|
int idxmax = m_candidates.size()-1;
|
||||||
|
|
||||||
int delta = m_candidates.size();
|
int delta = m_candidates.size();
|
||||||
if( delta & 1 && delta > 1 )
|
|
||||||
delta += 1;
|
int idx = 0; // Starting index is the beginning of list
|
||||||
delta /= 2;
|
|
||||||
int idx = delta; // Starting index is the middle of list
|
|
||||||
while( delta )
|
while( delta )
|
||||||
{
|
{
|
||||||
|
// Calculate half size of remaining interval to test.
|
||||||
|
// Ensure the computed value is not truncated (too small)
|
||||||
if( (delta & 1) && ( delta > 1 ) )
|
if( (delta & 1) && ( delta > 1 ) )
|
||||||
delta++;
|
delta++;
|
||||||
delta /= 2;
|
delta /= 2;
|
||||||
|
|
Loading…
Reference in New Issue