Skip to content

[libc][complex] check that cfloat128 is not defined as _Complex long double #119324

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 2 commits into from
Dec 10, 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
1 change: 1 addition & 0 deletions libc/include/llvm-libc-types/cfloat128.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef _Complex _Float128 cfloat128;
typedef _Complex __float128 cfloat128;
#elif (LDBL_MANT_DIG == 113)
#define LIBC_TYPES_HAS_CFLOAT128
#define LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE
typedef _Complex long double cfloat128;
#endif

Expand Down
4 changes: 4 additions & 0 deletions libc/src/__support/complex_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ template <> struct make_complex<float16> {
};
#endif
#if defined(LIBC_TYPES_HAS_CFLOAT128)
#if !(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
template <> struct make_complex<float128> {
using type = cfloat128;
};
#endif
#endif

template <typename T> using make_complex_t = typename make_complex<T>::type;

Expand All @@ -62,10 +64,12 @@ template <> struct make_real<cfloat16> {
};
#endif
#if defined(LIBC_TYPES_HAS_CFLOAT128)
#if !(LIBC_TYPES_CFLOAT128_IS_COMPLEX_LONG_DOUBLE)
template <> struct make_real<cfloat128> {
using type = float128;
};
#endif
#endif

template <typename T> using make_real_t = typename make_real<T>::type;

Expand Down
Loading