Prefer Clamp() to std::min( std::max() ).
This commit is contained in:
parent
2f2a00c307
commit
d545216432
|
@ -880,9 +880,9 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
int maxWidth = defaultDlgSize.x / 3;
|
||||
|
||||
if( col == m_grid->GetNumberCols() - 1 )
|
||||
m_grid->SetColSize( col, std::min( std::max( 50, textWidth ), maxWidth ) );
|
||||
m_grid->SetColSize( col, Clamp( 50, textWidth, maxWidth ) );
|
||||
else
|
||||
m_grid->SetColSize( col, std::min( std::max( 100, textWidth ), maxWidth ) );
|
||||
m_grid->SetColSize( col, Clamp( 100, textWidth, maxWidth ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ public:
|
|||
CastingType minI = static_cast<CastingType>( std::numeric_limits<int>::min() );
|
||||
CastingType maxI = static_cast<CastingType>( std::numeric_limits<int>::max() );
|
||||
|
||||
x = static_cast<int>( std::max( minI, std::min( aVec.x, maxI ) ) );
|
||||
y = static_cast<int>( std::max( minI, std::min( aVec.y, maxI ) ) );
|
||||
x = static_cast<int>( Clamp( minI, aVec.x, maxI ) );
|
||||
y = static_cast<int>( Clamp( minI, aVec.y, maxI ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -118,8 +118,8 @@ public:
|
|||
T minI = static_cast<T>( std::numeric_limits<int>::min() );
|
||||
T maxI = static_cast<T>( std::numeric_limits<int>::max() );
|
||||
|
||||
return VECTOR2<int>( static_cast<int>( std::max( minI, std::min( x, maxI ) ) ),
|
||||
static_cast<int>( std::max( minI, std::min( y, maxI ) ) ) );
|
||||
return VECTOR2<int>( static_cast<int>( Clamp( minI, x, maxI ) ),
|
||||
static_cast<int>( Clamp( minI, y, maxI ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue