From 8c6eb4ce22948fdae5292012207e232af0192bf2 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 15 Jan 2023 11:54:02 +0500 Subject: [PATCH] Extend types in GetClampedCoords. --- libs/kimath/include/geometry/geometry_utils.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/kimath/include/geometry/geometry_utils.h b/libs/kimath/include/geometry/geometry_utils.h index fd162b81b0..ca86bd4e36 100644 --- a/libs/kimath/include/geometry/geometry_utils.h +++ b/libs/kimath/include/geometry/geometry_utils.h @@ -152,21 +152,21 @@ VECTOR2 GetClampedCoords( const VECTOR2& aCoords, pad_type aP { typedef std::numeric_limits coord_limits; - long max = coord_limits::max() - aPadding; - long min = -max; + long long max = long long( coord_limits::max() ) - aPadding; + long long min = -max; in_type x = aCoords.x; in_type y = aCoords.y; if( x < min ) - x = min; + x = in_type( min ); else if( x > max ) - x = max; + x = in_type( max ); if( y < min ) - y = min; + y = in_type( min ); else if( y > max ) - y = max; + y = in_type( max ); if( !std::is_integral() && std::is_integral() ) return VECTOR2( KiROUND( x ), KiROUND( y ) );