Skip to content

Commit 0f694e1

Browse files
committed
Use static_cast
1 parent 97a05b0 commit 0f694e1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

libc/src/__support/FPUtil/Hypot.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ LIBC_INLINE T find_leading_one(T mant, int &shift_length) {
3030
if (mant > 0) {
3131
shift_length = (sizeof(mant) * 8) - 1 - cpp::countl_zero(mant);
3232
}
33-
return (T)(T(1) << shift_length);
33+
return static_cast<T>((T(1) << shift_length));
3434
}
3535

3636
} // namespace internal
@@ -207,9 +207,8 @@ LIBC_INLINE T hypot(T x, T y) {
207207

208208
for (StorageType current_bit = leading_one >> 1; current_bit;
209209
current_bit >>= 1) {
210-
r = (StorageType)(r << 1) + ((tail_bits & current_bit) ? 1 : 0);
211-
StorageType tmp =
212-
(StorageType)(y_new << 1) + current_bit; // 2*y_new(n - 1) + 2^(-n)
210+
r = static_cast<StorageType>((r << 1)) + ((tail_bits & current_bit) ? 1 : 0);
211+
StorageType tmp = static_cast<StorageType>((y_new << 1)) + current_bit; // 2*y_new(n - 1) + 2^(-n)
213212
if (r >= tmp) {
214213
r -= tmp;
215214
y_new += current_bit;

0 commit comments

Comments
 (0)