aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-07-24 11:38:32 +0100
committerJonathan Wakely <jwakely@redhat.com>2023-08-17 20:24:19 +0100
commitaad83d61d2e92b168688f7b6bd00b8604d11fc9f (patch)
treedd079ce056b9d61cae742429f9dda24cd22a9138 /libstdc++-v3/config
parent74c019b50b7724dd5ed7af640b6c0427383d48df (diff)
downloadgcc-aad83d61d2e92b168688f7b6bd00b8604d11fc9f.zip
gcc-aad83d61d2e92b168688f7b6bd00b8604d11fc9f.tar.gz
gcc-aad83d61d2e92b168688f7b6bd00b8604d11fc9f.tar.bz2
libstdc++: Reuse double overload of __convert_to_v if possible
For targets where double and long double have the same representation we can reuse the same __convert_to_v code for both types. This will slightly reduce the size of the compiled code in the library. libstdc++-v3/ChangeLog: * config/locale/generic/c_locale.cc (__convert_to_v): Reuse double overload for long double if possible.
Diffstat (limited to 'libstdc++-v3/config')
-rw-r--r--libstdc++-v3/config/locale/generic/c_locale.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc
index 8849d78..866ba03 100644
--- a/libstdc++-v3/config/locale/generic/c_locale.cc
+++ b/libstdc++-v3/config/locale/generic/c_locale.cc
@@ -187,6 +187,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__convert_to_v(const char* __s, long double& __v,
ios_base::iostate& __err, const __c_locale&) throw()
{
+#if __DBL_MANT_DIG__ == __LDBL_MANT_DIG__
+ double __d;
+ __convert_to_v(__s, __d, __err, __c_locale);
+ __v = __d;
+#else
// Assumes __s formatted for "C" locale.
const char* __sav = __set_C_locale();
if (!__sav)
@@ -233,6 +238,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
setlocale(LC_ALL, __sav);
delete [] __sav;
+#endif // __DBL_MANT_DIG__ == __LDBL_MANT_DIG__
}
void