diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index 12c79741a5..e5bef2e4f1 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -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 ) ); } } } diff --git a/libs/kimath/include/math/vector2d.h b/libs/kimath/include/math/vector2d.h index e57cbbb3c4..82a8a4ebc3 100644 --- a/libs/kimath/include/math/vector2d.h +++ b/libs/kimath/include/math/vector2d.h @@ -104,8 +104,8 @@ public: CastingType minI = static_cast( std::numeric_limits::min() ); CastingType maxI = static_cast( std::numeric_limits::max() ); - x = static_cast( std::max( minI, std::min( aVec.x, maxI ) ) ); - y = static_cast( std::max( minI, std::min( aVec.y, maxI ) ) ); + x = static_cast( Clamp( minI, aVec.x, maxI ) ); + y = static_cast( Clamp( minI, aVec.y, maxI ) ); } else { @@ -130,8 +130,8 @@ public: T minI = static_cast( std::numeric_limits::min() ); T maxI = static_cast( std::numeric_limits::max() ); - return VECTOR2( static_cast( std::max( minI, std::min( x, maxI ) ) ), - static_cast( std::max( minI, std::min( y, maxI ) ) ) ); + return VECTOR2( static_cast( Clamp( minI, x, maxI ) ), + static_cast( Clamp( minI, y, maxI ) ) ); } else {