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
11 changes: 1 addition & 10 deletions core/libs/prx/libc/src/Math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,16 +1333,7 @@ int APS5_VABI __isnanf_nid_postfix(float x) { return std::isnan(x) ? 1 : 0; }
int APS5_VABI isnanf_nid_postfix(float x) { return __isnanf_nid_postfix(x); }
int APS5_VABI isnan_nid_postfix(double x) { return __isnan_nid_postfix(x); }
int APS5_VABI isinf_nid_postfix(double x) { return __isinf_nid_postfix(x); }
int APS5_VABI __fpclassifyf_nid_postfix(float x) {
constexpr int Infinite = 0x01, NotANumber = 0x02, Normal = 0x04, Subnormal = 0x08, Zero = 0x10;
std::uint32_t bits;
std::memcpy(&bits, &x, sizeof(bits));
const auto exponent = bits & 0x7f800000u;
const auto fraction = bits & 0x007fffffu;
if (exponent == 0) return fraction != 0 ? Subnormal : Zero;
if (exponent == 0x7f800000u) return fraction != 0 ? NotANumber : Infinite;
return Normal;
}
int APS5_VABI __fpclassifyf_nid_postfix(float x) { return _FDtest_nid_postfix(&x); }
int APS5_VABI __signbitf_nid_postfix(float x) { return std::signbit(x) ? 1 : 0; }
int APS5_VABI __signbitl_nid_postfix(long double x) {
static_assert(sizeof(long double) == 16, "guest long double requires x87 extended precision storage");
Expand Down
3 changes: 1 addition & 2 deletions core/libs/tests/GuestMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,8 +1142,7 @@ static void CheckFloatClassification() {
std::fprintf(stderr, "Guest _FDtest failed for %08x\n", test.bits);
std::abort();
}
const int fpclass = test.code == 0 ? 0x10 : test.code == -2 ? 0x08 : test.code == -1 ? 0x04 : test.code == 1 ? 0x01 : 0x02;
if (__fpclassifyf_nid_postfix(value) != fpclass) {
if (__fpclassifyf_nid_postfix(value) != test.code) {
std::fprintf(stderr, "Guest __fpclassifyf failed for %08x\n", test.bits);
std::abort();
}
Expand Down
Loading