Skip to content

Commit 68cac73

Browse files
committed
[Libc] Two more implicit to explicit cast changes
Those two instanced were also flagged with a warning after llvm#126846 landed. I believe using type T here makes sense, but I can very well be wrong.
1 parent 3382119 commit 68cac73

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

libc/src/__support/CPP/bit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ ADD_SPECIALIZATION(countl_zero, unsigned long long, __builtin_clzll)
162162
template <typename T>
163163
[[nodiscard]] LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_unsigned_v<T>, int>
164164
countl_one(T value) {
165-
return cpp::countl_zero<T>(~value);
165+
return cpp::countl_zero<T>(static_cast<T>(~value));
166166
}
167167

168168
/// Count the number of ones from the least significant bit to the first
@@ -175,7 +175,7 @@ countl_one(T value) {
175175
template <typename T>
176176
[[nodiscard]] LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_unsigned_v<T>, int>
177177
countr_one(T value) {
178-
return cpp::countr_zero<T>(~value);
178+
return cpp::countr_zero<T>(static_cast<T>(~value));
179179
}
180180

181181
/// Returns the number of bits needed to represent value if value is nonzero.

0 commit comments

Comments
 (0)