mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-12 12:39:02 +08:00
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`
This commit is contained in:
parent
bd1e8de7dd
commit
43ada9a7f1
@ -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<T>::value && std::is_integral<OutT>::value) {
|
||||
if (!std::is_same<T, bool>::value && std::is_integral<T>::value &&
|
||||
std::is_integral<OutT>::value) {
|
||||
static constexpr OutT kOutMin =
|
||||
std::is_signed<T>::value ? std::numeric_limits<OutT>::lowest() : 0;
|
||||
if (in_value < kOutMin || in_value > std::numeric_limits<OutT>::max()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user