[libc] Fix implicit conversion warnings. (#130635)

This commit is contained in:
lntue
2025-03-10 12:51:38 -04:00
committed by GitHub
parent 3db668e0bb
commit 7e292772ad
2 changed files with 3 additions and 3 deletions

View File

@@ -162,7 +162,7 @@ ADD_SPECIALIZATION(countl_zero, unsigned long long, __builtin_clzll)
template <typename T>
[[nodiscard]] LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_unsigned_v<T>, int>
countl_one(T value) {
return cpp::countl_zero<T>(~value);
return cpp::countl_zero<T>(static_cast<T>(~value));
}
/// Count the number of ones from the least significant bit to the first
@@ -175,7 +175,7 @@ countl_one(T value) {
template <typename T>
[[nodiscard]] LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_unsigned_v<T>, int>
countr_one(T value) {
return cpp::countr_zero<T>(~value);
return cpp::countr_zero<T>(static_cast<T>(~value));
}
/// Returns the number of bits needed to represent value if value is nonzero.

View File

@@ -287,7 +287,7 @@ LIBC_INLINE UInt<MID_INT_SIZE> get_table_negative(int exponent, size_t i) {
size_t ten_blocks = i;
size_t five_blocks = 0;
if (shift_amount < 0) {
int block_shifts = (-shift_amount) / BLOCK_SIZE;
int block_shifts = (-shift_amount) / static_cast<int>(BLOCK_SIZE);
if (block_shifts < static_cast<int>(ten_blocks)) {
ten_blocks = ten_blocks - block_shifts;
five_blocks = block_shifts;