From 47205d088f246efb43b088a265917e728e9c0369 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 9 Jun 2021 13:05:45 -0700 Subject: [PATCH] SPEC-2513 Fixes to enable w4310 --- Code/CryEngine/CryCommon/CryCustomTypes.h | 6 ++---- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Code/CryEngine/CryCommon/CryCustomTypes.h b/Code/CryEngine/CryCommon/CryCustomTypes.h index 25578ce9cc..8d896f0bf3 100644 --- a/Code/CryEngine/CryCommon/CryCustomTypes.h +++ b/Code/CryEngine/CryCommon/CryCustomTypes.h @@ -282,11 +282,9 @@ struct TIntTraits static const size_t nPOS_BITS = sizeof(T) * 8 - bSIGNED; - static const T nMIN - = bSIGNED ? T (T(1) << (T(sizeof(T) * 8 - 1))) : T(0); + static const T nMIN = std::numeric_limits::min(); - static const T nMAX - = ~nMIN; + static const T nMAX = std::numeric_limits::max(); }; template diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index b07a87a35a..3d558129d4 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -66,7 +66,6 @@ ly_append_configurations_options( /wd4244 # conversion, possible loss of data /wd4245 # conversion, signed/unsigned mismatch /wd4267 # conversion, possible loss of data - /wd4310 # cast truncates constant value /wd4389 # comparison, signed/unsigned mismatch # Enabling warnings that are disabled by default from /W4