Skip to content

Commit eac2f32

Browse files
more fixes
1 parent 7e263a6 commit eac2f32

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

libc/src/__support/FPUtil/FPBits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ template <FPType fp_type> struct FPStorage : public FPLayout<fp_type> {
251251

252252
// Cast operator to get convert from BiasedExponent to Exponent.
253253
LIBC_INLINE constexpr operator Exponent() const {
254-
return Exponent(UP::value - EXP_BIAS);
254+
return Exponent(static_cast<int32_t>(UP::value - EXP_BIAS));
255255
}
256256

257257
LIBC_INLINE constexpr BiasedExponent &operator++() {

libc/src/__support/FPUtil/NormalFloat.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "src/__support/macros/config.h"
1717

1818
#include <stdint.h>
19+
#include <sys/_types/_int32_t.h>
1920

2021
namespace LIBC_NAMESPACE_DECL {
2122
namespace fputil {
@@ -105,7 +106,7 @@ template <typename T> struct NormalFloat {
105106

106107
constexpr int SUBNORMAL_EXPONENT = -FPBits<T>::EXP_BIAS + 1;
107108
if (exponent < SUBNORMAL_EXPONENT) {
108-
unsigned shift = SUBNORMAL_EXPONENT - exponent;
109+
unsigned shift = static_cast<unsigned>(SUBNORMAL_EXPONENT - exponent);
109110
// Since exponent > subnormalExponent, shift is strictly greater than
110111
// zero.
111112
if (shift <= FPBits<T>::FRACTION_LEN + 1) {
@@ -160,7 +161,7 @@ template <typename T> struct NormalFloat {
160161
if (bits.is_subnormal()) {
161162
unsigned shift = evaluate_normalization_shift(bits.get_mantissa());
162163
mantissa = static_cast<StorageType>(bits.get_mantissa() << shift);
163-
exponent = 1 - FPBits<T>::EXP_BIAS - shift;
164+
exponent = 1 - FPBits<T>::EXP_BIAS - static_cast<int32_t>(shift);
164165
} else {
165166
exponent = bits.get_biased_exponent() - FPBits<T>::EXP_BIAS;
166167
mantissa = ONE | bits.get_mantissa();

libc/src/__support/str_to_integer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ strtointeger(const char *__restrict src, int base,
9696
if (base < 0 || base == 1 || base > 36)
9797
return {0, 0, EINVAL};
9898

99-
src_cur = first_non_whitespace(src, src_len) - src;
99+
src_cur = static_cast<size_t>(first_non_whitespace(src, src_len) - src);
100100

101101
char result_sign = '+';
102102
if (src[src_cur] == '+' || src[src_cur] == '-') {

0 commit comments

Comments
 (0)