Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions libc/src/__support/FPUtil/generic/add_sub.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<InStorageType>(
max_bits.get_explicit_mantissa() << GUARD_BITS_LEN);
InStorageType min_mant = static_cast<InStorageType>(
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());
Expand All @@ -172,7 +174,8 @@ add_or_sub(InType x, InType y) {
(static_cast<InStorageType>(
min_mant << (InFPBits::STORAGE_LEN - alignment))) != 0;

InStorageType min_mant_sticky(static_cast<int>(aligned_min_mant_sticky));
InStorageType min_mant_sticky =
static_cast<InStorageType>(static_cast<int>(aligned_min_mant_sticky));

if (is_effectively_add)
result_mant = max_mant + (aligned_min_mant | min_mant_sticky);
Expand Down
7 changes: 4 additions & 3 deletions libc/test/src/math/FmaTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>(LIBC_NAMESPACE::rand());
bits = static_cast<InStorageType>(
(bits << 2) + static_cast<uint16_t>(LIBC_NAMESPACE::rand()));
}
return bits;
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions libc/test/src/math/HypotTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<StorageType>(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;
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/wchar/wcstol_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

#include "WcstolTest.h"

WCSTOL_TEST(Wcstol, LIBC_NAMESPACE::wcstol)
WCSTOL_TEST(Wcstol, LIBC_NAMESPACE::wcstol)
2 changes: 1 addition & 1 deletion libc/test/src/wchar/wcstoll_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

#include "WcstolTest.h"

WCSTOL_TEST(Wcstoll, LIBC_NAMESPACE::wcstoll)
WCSTOL_TEST(Wcstoll, LIBC_NAMESPACE::wcstoll)
2 changes: 1 addition & 1 deletion libc/test/src/wchar/wcstoul_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

#include "WcstolTest.h"

WCSTOL_TEST(Wcstoul, LIBC_NAMESPACE::wcstoul)
WCSTOL_TEST(Wcstoul, LIBC_NAMESPACE::wcstoul)
2 changes: 1 addition & 1 deletion libc/test/src/wchar/wcstoull_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

#include "WcstolTest.h"

WCSTOL_TEST(Wcstoull, LIBC_NAMESPACE::wcstoull)
WCSTOL_TEST(Wcstoull, LIBC_NAMESPACE::wcstoull)
Loading