diff --git a/libc/src/__support/FPUtil/generic/add_sub.h b/libc/src/__support/FPUtil/generic/add_sub.h index fda702931ef6f..7205d8d41f5bd 100644 --- a/libc/src/__support/FPUtil/generic/add_sub.h +++ b/libc/src/__support/FPUtil/generic/add_sub.h @@ -153,8 +153,10 @@ add_or_sub(InType x, InType y) { result_mant <<= GUARD_BITS_LEN; } else { - InStorageType max_mant = max_bits.get_explicit_mantissa() << GUARD_BITS_LEN; - InStorageType min_mant = min_bits.get_explicit_mantissa() << GUARD_BITS_LEN; + InStorageType max_mant = static_cast( + max_bits.get_explicit_mantissa() << GUARD_BITS_LEN); + InStorageType min_mant = static_cast( + min_bits.get_explicit_mantissa() << GUARD_BITS_LEN); int alignment = (max_bits.get_biased_exponent() - max_bits.is_normal()) - (min_bits.get_biased_exponent() - min_bits.is_normal()); @@ -172,7 +174,8 @@ add_or_sub(InType x, InType y) { (static_cast( min_mant << (InFPBits::STORAGE_LEN - alignment))) != 0; - InStorageType min_mant_sticky(static_cast(aligned_min_mant_sticky)); + InStorageType min_mant_sticky = + static_cast(static_cast(aligned_min_mant_sticky)); if (is_effectively_add) result_mant = max_mant + (aligned_min_mant | min_mant_sticky); diff --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h index 5c5419ce3ab4d..902ff0413b0fa 100644 --- a/libc/test/src/math/FmaTest.h +++ b/libc/test/src/math/FmaTest.h @@ -48,7 +48,8 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest { InStorageType get_random_bit_pattern() { InStorageType bits{0}; for (InStorageType i = 0; i < sizeof(InStorageType) / 2; ++i) { - bits = (bits << 2) + static_cast(LIBC_NAMESPACE::rand()); + bits = static_cast( + (bits << 2) + static_cast(LIBC_NAMESPACE::rand())); } return bits; } @@ -57,7 +58,7 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest { using FmaFunc = OutType (*)(InType, InType, InType); void test_subnormal_range(FmaFunc func) { - constexpr InStorageType COUNT = 100'001; + constexpr InStorageType COUNT = 10'001; constexpr InStorageType RAW_STEP = (IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT; constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP); @@ -75,7 +76,7 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest { } void test_normal_range(FmaFunc func) { - constexpr InStorageType COUNT = 100'001; + constexpr InStorageType COUNT = 10'001; constexpr InStorageType RAW_STEP = (IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT; constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP); diff --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h index dc73581e67ff0..b37abf7e156d3 100644 --- a/libc/test/src/math/HypotTest.h +++ b/libc/test/src/math/HypotTest.h @@ -71,8 +71,9 @@ class HypotTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest { void test_subnormal_range(Func func) { constexpr StorageType COUNT = 10'001; - for (unsigned scale = 0; scale < 4; ++scale) { - StorageType max_value = MAX_SUBNORMAL << scale; + constexpr unsigned SCALE = (sizeof(T) < 4) ? 1 : 4; + for (unsigned scale = 0; scale < SCALE; ++scale) { + StorageType max_value = static_cast(MAX_SUBNORMAL << scale); StorageType step = (max_value - MIN_SUBNORMAL) / COUNT + 1; for (int signs = 0; signs < 4; ++signs) { for (StorageType v = MIN_SUBNORMAL, w = max_value; diff --git a/libc/test/src/wchar/wcstol_test.cpp b/libc/test/src/wchar/wcstol_test.cpp index 9ae32ba5183e6..2dd0bc7e2b0c6 100644 --- a/libc/test/src/wchar/wcstol_test.cpp +++ b/libc/test/src/wchar/wcstol_test.cpp @@ -12,4 +12,4 @@ #include "WcstolTest.h" -WCSTOL_TEST(Wcstol, LIBC_NAMESPACE::wcstol) \ No newline at end of file +WCSTOL_TEST(Wcstol, LIBC_NAMESPACE::wcstol) diff --git a/libc/test/src/wchar/wcstoll_test.cpp b/libc/test/src/wchar/wcstoll_test.cpp index c24c1f69b1cec..00a241aa88f20 100644 --- a/libc/test/src/wchar/wcstoll_test.cpp +++ b/libc/test/src/wchar/wcstoll_test.cpp @@ -12,4 +12,4 @@ #include "WcstolTest.h" -WCSTOL_TEST(Wcstoll, LIBC_NAMESPACE::wcstoll) \ No newline at end of file +WCSTOL_TEST(Wcstoll, LIBC_NAMESPACE::wcstoll) diff --git a/libc/test/src/wchar/wcstoul_test.cpp b/libc/test/src/wchar/wcstoul_test.cpp index ab0afb951c495..63b630daa9f13 100644 --- a/libc/test/src/wchar/wcstoul_test.cpp +++ b/libc/test/src/wchar/wcstoul_test.cpp @@ -12,4 +12,4 @@ #include "WcstolTest.h" -WCSTOL_TEST(Wcstoul, LIBC_NAMESPACE::wcstoul) \ No newline at end of file +WCSTOL_TEST(Wcstoul, LIBC_NAMESPACE::wcstoul) diff --git a/libc/test/src/wchar/wcstoull_test.cpp b/libc/test/src/wchar/wcstoull_test.cpp index adba4f16e68d6..12895d3ed4148 100644 --- a/libc/test/src/wchar/wcstoull_test.cpp +++ b/libc/test/src/wchar/wcstoull_test.cpp @@ -12,4 +12,4 @@ #include "WcstolTest.h" -WCSTOL_TEST(Wcstoull, LIBC_NAMESPACE::wcstoull) \ No newline at end of file +WCSTOL_TEST(Wcstoull, LIBC_NAMESPACE::wcstoull)