-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
The following section spawns a C4804 warning when the template type T is bool:
geometry_attribute.h(290,13): warning C4804: '<': unsafe use of type 'bool' in operation
geometry_attribute.h(290,35): warning C4804: '>': unsafe use of type 'bool' in operation
draco/src/draco/attributes/geometry_attribute.h
Lines 287 to 293 in 9522c22
| if (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()) { | |
| return false; | |
| } | |
| } |
This warning can be avoided by skipping the check when type T is bool. This check can be skipped safely since we are guaranteed that bool will fit in the output type OutT, given that OutT is an integral type.
Suggested change on Line 287:
if (!std::is_same<T, bool>::value && std::is_integral<T>::value && std::is_integral<OutT>::value) {Metadata
Metadata
Assignees
Labels
No labels