Skip to content

[libc][NFC] Refactor FPBits and remove LongDoubleBits specialization #78192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 16, 2024
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
443 changes: 352 additions & 91 deletions libc/src/__support/FPUtil/FPBits.h

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ LIBC_INLINE long double sqrt(long double x) {
out.set_implicit_bit(1);
out.set_mantissa((y & (ONE - 1)));

return out;
return out.get_val();
}
}
#endif // LIBC_LONG_DOUBLE_IS_X86_FLOAT80
Expand Down
179 changes: 0 additions & 179 deletions libc/src/__support/FPUtil/x86_64/LongDoubleBits.h

This file was deleted.

8 changes: 4 additions & 4 deletions libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ LIBC_INLINE long double nextafter(long double from, long double to) {
from_bits.set_biased_exponent(from_bits.get_biased_exponent() + 1);
if (from_bits.is_inf())
raise_except_if_required(FE_OVERFLOW | FE_INEXACT);
return from_bits;
return from_bits.get_val();
} else {
++int_val;
}
Expand All @@ -75,7 +75,7 @@ LIBC_INLINE long double nextafter(long double from, long double to) {
// from == 0 is handled separately so decrementing the exponent will not
// lead to underflow.
from_bits.set_biased_exponent(from_bits.get_biased_exponent() - 1);
return from_bits;
return from_bits.get_val();
} else {
--int_val;
}
Expand All @@ -94,7 +94,7 @@ LIBC_INLINE long double nextafter(long double from, long double to) {
// from == 0 is handled separately so decrementing the exponent will not
// lead to underflow.
from_bits.set_biased_exponent(from_bits.get_biased_exponent() - 1);
return from_bits;
return from_bits.get_val();
} else {
--int_val;
}
Expand All @@ -109,7 +109,7 @@ LIBC_INLINE long double nextafter(long double from, long double to) {
from_bits.set_biased_exponent(from_bits.get_biased_exponent() + 1);
if (from_bits.is_inf())
raise_except_if_required(FE_OVERFLOW | FE_INEXACT);
return from_bits;
return from_bits.get_val();
} else {
++int_val;
}
Expand Down
Loading