Skip to content

Commit 17aa810

Browse files
Simplify bool -> int conversion in GfNumericCast
1 parent 2baddc7 commit 17aa810

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
@@ -89,7 +89,7 @@ GfNumericCast(From from, GfNumericCastFailureType *failType = nullptr)
8989
// bool -> int
9090
if constexpr (std::is_same_v<From, bool> && std::is_integral_v<To>) {
9191
// No need to range check bool to int
92-
return from ? static_cast<To>(1) : static_cast<To>(0);
92+
return To{from};
9393
}
9494
// int -> bool
9595
else if constexpr (std::is_integral_v<From> && std::is_same_v<To, bool>) {

0 commit comments

Comments
 (0)