Skip to content

Commit 7e29277

Browse files
authored
[libc] Fix implicit conversion warnings. (#130635)
1 parent 3db668e commit 7e29277

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
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.

libc/src/__support/float_to_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ LIBC_INLINE UInt<MID_INT_SIZE> get_table_negative(int exponent, size_t i) {
287287
size_t ten_blocks = i;
288288
size_t five_blocks = 0;
289289
if (shift_amount < 0) {
290-
int block_shifts = (-shift_amount) / BLOCK_SIZE;
290+
int block_shifts = (-shift_amount) / static_cast<int>(BLOCK_SIZE);
291291
if (block_shifts < static_cast<int>(ten_blocks)) {
292292
ten_blocks = ten_blocks - block_shifts;
293293
five_blocks = block_shifts;

0 commit comments

Comments
 (0)