From 43ada9a7f1d2ce52fb5d40bee3cad03f1927fdeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Blissing?= Date: Sat, 26 Feb 2022 05:46:51 +0100 Subject: [PATCH] Avoid comparing bool using the < and > operator (#817) There is no need to perform the check if T is of type bool, since it is guaranteed to fit in all other integral types. This avoids triggering a C4804 warning in Visual Studio, ie. `unsafe use of type 'bool' in operation` --- src/draco/attributes/geometry_attribute.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/draco/attributes/geometry_attribute.h b/src/draco/attributes/geometry_attribute.h index fd478a4..5d4a22f 100644 --- a/src/draco/attributes/geometry_attribute.h +++ b/src/draco/attributes/geometry_attribute.h @@ -284,7 +284,8 @@ class GeometryAttribute { // Make sure the in_value fits within the range of values that OutT // is able to represent. Perform the check only for integral types. - if (std::is_integral::value && std::is_integral::value) { + if (!std::is_same::value && std::is_integral::value && + std::is_integral::value) { static constexpr OutT kOutMin = std::is_signed::value ? std::numeric_limits::lowest() : 0; if (in_value < kOutMin || in_value > std::numeric_limits::max()) {