Skip to content

Commit be75edf

Browse files
Simplify bool -> int conversion in GfNumericCast
1 parent 0f3439a commit be75edf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pxr/base/gf/numericCast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ GfNumericCast(From from, GfNumericCastFailureType *failType = nullptr)
103103
// bool -> int
104104
if constexpr (std::is_same_v<From, bool> && std::is_integral_v<To>) {
105105
// No need to range check bool to int
106-
return from ? static_cast<To>(1) : static_cast<To>(0);
106+
return To{from};
107107
}
108108
// int -> bool
109109
else if constexpr (std::is_integral_v<From> && std::is_same_v<To, bool>) {

0 commit comments

Comments
 (0)