Skip to content

Commit 950f8f7

Browse files
shorten ternary
1 parent c2381aa commit 950f8f7

File tree

1 file changed

+1
-2
lines changed
  • libc/src/__support/CPP

1 file changed

+1
-2
lines changed

libc/src/__support/CPP/bit.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ template <typename T, typename = cpp::enable_if_t<cpp::is_unsigned_v<T>>>
233233

234234
template <typename T, typename = cpp::enable_if_t<cpp::is_unsigned_v<T>>>
235235
[[nodiscard]] LIBC_INLINE constexpr int first_leading_one(T value) {
236-
return value == static_cast<T>(0) ? 0
237-
: countl_zero<T>(static_cast<T>(value)) + 1;
236+
return !value ? 0 : countl_zero<T>(static_cast<T>(value)) + 1;
238237
}
239238

240239
} // namespace LIBC_NAMESPACE::cpp

0 commit comments

Comments
 (0)