feat(libc): implement __powidf2
The H+8UBOwfScI import was a throwing stub (libcCyberUnknown08). It is the NID of "__powidf2", the double-precision integer-power helper that complements __powisf2.
This commit is contained in:
parent
c827e11872
commit
b4e2ee0a13
|
|
@ -26,12 +26,6 @@ int APS5_VABI _ZSt14_Atomic_assertPKcS0__nid_postfix() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
APS5_EXPORT("H+8UBOwfScI", libcCyberUnknown08);
|
|
||||||
std::uint64_t APS5_VABI libcCyberUnknown08(void) {
|
|
||||||
NotImplemented_nid_no_patch("H+8UBOwfScI");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
APS5_EXPORT("H2e8t5ScQGc", libc___cxa_finalize);
|
APS5_EXPORT("H2e8t5ScQGc", libc___cxa_finalize);
|
||||||
void APS5_VABI libc___cxa_finalize(void* dsoHandle) {
|
void APS5_VABI libc___cxa_finalize(void* dsoHandle) {
|
||||||
CxaFinalize_nid_no_patch(dsoHandle);
|
CxaFinalize_nid_no_patch(dsoHandle);
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,18 @@ float APS5_VABI __powisf2_nid_postfix(float base, int exponent) {
|
||||||
}
|
}
|
||||||
return reciprocal ? 1.0f / result : result;
|
return reciprocal ? 1.0f / result : result;
|
||||||
}
|
}
|
||||||
|
double APS5_VABI __powidf2_nid_postfix(double base, int exponent) {
|
||||||
|
const bool reciprocal = exponent < 0;
|
||||||
|
double result = 1.0;
|
||||||
|
unsigned int magnitude = reciprocal ? 0u - static_cast<unsigned int>(exponent) : static_cast<unsigned int>(exponent);
|
||||||
|
while (magnitude != 0u) {
|
||||||
|
if ((magnitude & 1u) != 0u) result *= base;
|
||||||
|
magnitude >>= 1u;
|
||||||
|
if (magnitude == 0u) break;
|
||||||
|
base *= base;
|
||||||
|
}
|
||||||
|
return reciprocal ? 1.0 / result : result;
|
||||||
|
}
|
||||||
float APS5_VABI expf_nid_postfix(float x) { return std::exp(x); }
|
float APS5_VABI expf_nid_postfix(float x) { return std::exp(x); }
|
||||||
float APS5_VABI exp2f_nid_postfix(float x) { return std::exp2(x); }
|
float APS5_VABI exp2f_nid_postfix(float x) { return std::exp2(x); }
|
||||||
float APS5_VABI logf_nid_postfix(float x) { return std::log(x); }
|
float APS5_VABI logf_nid_postfix(float x) { return std::log(x); }
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ double APS5_VABI lgamma_nid_postfix(double);
|
||||||
float APS5_VABI logbf_nid_postfix(float);
|
float APS5_VABI logbf_nid_postfix(float);
|
||||||
double APS5_VABI exp2_nid_postfix(double);
|
double APS5_VABI exp2_nid_postfix(double);
|
||||||
float APS5_VABI __powisf2_nid_postfix(float, int);
|
float APS5_VABI __powisf2_nid_postfix(float, int);
|
||||||
|
double APS5_VABI __powidf2_nid_postfix(double, int);
|
||||||
double APS5_VABI ldexp_nid_postfix(double, int);
|
double APS5_VABI ldexp_nid_postfix(double, int);
|
||||||
double APS5_VABI scalbn_nid_postfix(double, int);
|
double APS5_VABI scalbn_nid_postfix(double, int);
|
||||||
float APS5_VABI scalbnf_nid_postfix(float, int);
|
float APS5_VABI scalbnf_nid_postfix(float, int);
|
||||||
|
|
@ -869,6 +870,21 @@ int main() {
|
||||||
Require(std::signbit(__powisf2_nid_postfix(-0.0f, 3)));
|
Require(std::signbit(__powisf2_nid_postfix(-0.0f, 3)));
|
||||||
Require(std::isinf(__powisf2_nid_postfix(-0.0f, -3)) && std::signbit(__powisf2_nid_postfix(-0.0f, -3)));
|
Require(std::isinf(__powisf2_nid_postfix(-0.0f, -3)) && std::signbit(__powisf2_nid_postfix(-0.0f, -3)));
|
||||||
Require(__powisf2_nid_postfix(2.0f, -127) == 0x1p-127f);
|
Require(__powisf2_nid_postfix(2.0f, -127) == 0x1p-127f);
|
||||||
|
Require(__powidf2_nid_postfix(2.0, 10) == 1024.0);
|
||||||
|
Require(__powidf2_nid_postfix(2.0, -10) == 0.0009765625);
|
||||||
|
Require(__powidf2_nid_postfix(-2.0, 3) == -8.0);
|
||||||
|
Require(__powidf2_nid_postfix(-2.0, -3) == -0.125);
|
||||||
|
Require(__powidf2_nid_postfix(-2.0, 4) == 16.0);
|
||||||
|
Require(__powidf2_nid_postfix(0.0, 0) == 1.0);
|
||||||
|
Require(__powidf2_nid_postfix(std::numeric_limits<double>::quiet_NaN(), 0) == 1.0);
|
||||||
|
Require(std::isnan(__powidf2_nid_postfix(std::numeric_limits<double>::quiet_NaN(), 1)));
|
||||||
|
Require(__powidf2_nid_postfix(-1.0, std::numeric_limits<int>::min()) == 1.0);
|
||||||
|
Require(__powidf2_nid_postfix(-1.0, std::numeric_limits<int>::max()) == -1.0);
|
||||||
|
Require(__powidf2_nid_postfix(2.0, std::numeric_limits<int>::min()) == 0.0);
|
||||||
|
Require(std::isinf(__powidf2_nid_postfix(0.0, -1)));
|
||||||
|
Require(std::signbit(__powidf2_nid_postfix(-0.0, 3)));
|
||||||
|
Require(std::isinf(__powidf2_nid_postfix(-0.0, -3)) && std::signbit(__powidf2_nid_postfix(-0.0, -3)));
|
||||||
|
Require(__powidf2_nid_postfix(2.0, -127) == 0x1p-127);
|
||||||
CheckHyperbolic();
|
CheckHyperbolic();
|
||||||
CheckSinhf();
|
CheckSinhf();
|
||||||
CheckAtanhf();
|
CheckAtanhf();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue