[libc-commits] [libc] 1599452 - [libc][NFC] Fix str_to_float and uint warnings
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Tue Aug 1 11:08:14 PDT 2023
Author: Michael Jones
Date: 2023-08-01T11:08:10-07:00
New Revision: 15994529e06416923080df17ddc24fb32f1c4f0c
URL: https://github.com/llvm/llvm-project/commit/15994529e06416923080df17ddc24fb32f1c4f0c
DIFF: https://github.com/llvm/llvm-project/commit/15994529e06416923080df17ddc24fb32f1c4f0c.diff
LOG: [libc][NFC] Fix str_to_float and uint warnings
More Wconversion and Wno-sign-conversion warning fixes.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D156812
Added:
Modified:
libc/src/__support/UInt.h
libc/src/__support/str_to_float.h
Removed:
################################################################################
diff --git a/libc/src/__support/UInt.h b/libc/src/__support/UInt.h
index a748d47cd06cc8..2b187586c3ba4c 100644
--- a/libc/src/__support/UInt.h
+++ b/libc/src/__support/UInt.h
@@ -381,7 +381,7 @@ template <size_t Bits, bool Signed> struct BigInt {
BigInt<Bits, Signed> quotient(0);
BigInt<Bits, Signed> subtractor = other;
- int cur_bit = subtractor.clz() - this->clz();
+ int cur_bit = static_cast<int>(subtractor.clz() - this->clz());
subtractor.shift_left(cur_bit);
for (; cur_bit >= 0 && *this > 0; --cur_bit, subtractor.shift_right(1)) {
diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h
index 83cd420f150e80..2a8b93c7458a6e 100644
--- a/libc/src/__support/str_to_float.h
+++ b/libc/src/__support/str_to_float.h
@@ -1196,7 +1196,7 @@ LIBC_INLINE StrToNumResult<T> strtofloatingpoint(const char *__restrict src) {
if (strtoint_result.has_error()) {
error = strtoint_result.error;
}
- nan_mantissa = strtoint_result.value;
+ nan_mantissa = static_cast<BitsType>(strtoint_result.value);
if (src[left_paren + 1 + strtoint_result.parsed_len] != ')')
nan_mantissa = 0;
}
More information about the libc-commits
mailing list