BAN/LibC: Move ldexp, scalbn to libc

They are now implemented with float decompostion to modify the exponent
bits directly
This commit is contained in:
2026-07-10 00:44:28 +03:00
parent f0e95ffe48
commit efb25e5666
2 changed files with 35 additions and 34 deletions

View File

@@ -309,36 +309,6 @@ namespace BAN::Math
return exp2<T>(y * log2<T>(x));
}
template<floating_point T>
inline constexpr T scalbn(T x, int n)
{
asm("fscale" : "+t"(x) : "u"(static_cast<T>(n)));
return x;
}
template<floating_point T>
inline constexpr T ldexp(T x, int y)
{
const bool exp_sign = y < 0;
if (exp_sign)
y = -y;
T exp = (T)1.0;
T mult = (T)2.0;
while (y)
{
if (y & 1)
exp *= mult;
mult *= mult;
y >>= 1;
}
if (exp_sign)
exp = (T)1.0 / exp;
return x * exp;
}
template<floating_point T>
inline constexpr T sqrt(T x)
{