aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2006-07-09 21:26:19 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2006-07-09 21:26:19 +0000
commit5c171a745d5975a6e9c2505235fa3b9013caed22 (patch)
treeeb2884c9c43d3a8c3d6b5d26928d43dcec98d1b7 /libstdc++-v3
parent3f01f6f15d6289465e1062565bf4ffa144cef138 (diff)
downloadgcc-5c171a745d5975a6e9c2505235fa3b9013caed22.zip
gcc-5c171a745d5975a6e9c2505235fa3b9013caed22.tar.gz
gcc-5c171a745d5975a6e9c2505235fa3b9013caed22.tar.bz2
locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), [...]): Remove.
2006-07-09 Paolo Carlini <pcarlini@suse.de> * include/bits/locale_facets.tcc (__int_to_char<>(_CharT*, long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*, unsigned long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*, unsigned long long, const _CharT*, ios_base::fmtflags)): Remove. (__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags, bool)): Adjust. (num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)): Likewise. From-SVN: r115298
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog13
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc66
2 files changed, 24 insertions, 55 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 9395a4a..d7a5f09 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,16 @@
+2006-07-09 Paolo Carlini <pcarlini@suse.de>
+
+ * include/bits/locale_facets.tcc (__int_to_char<>(_CharT*,
+ long, const _CharT*, ios_base::fmtflags), __int_to_char<>(_CharT*,
+ unsigned long, const _CharT*, ios_base::fmtflags),
+ __int_to_char<>(_CharT*, long long, const _CharT*, ios_base::fmtflags),
+ __int_to_char<>(_CharT*, unsigned long long, const _CharT*,
+ ios_base::fmtflags)): Remove.
+ (__int_to_char<>(_CharT*, _ValueT, const _CharT*, ios_base::fmtflags,
+ bool)): Adjust.
+ (num_put<>::_M_insert_int(_OutIter, ios_base&, _CharT, _ValueT)):
+ Likewise.
+
2006-07-06 Paolo Carlini <pcarlini@suse.de>
* include/tr1/random (class gamma_distribution<>): Add.
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index fd9b0bd..a889e01 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -925,60 +925,13 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
_GLIBCXX_END_LDBL_NAMESPACE
- // Forwarding functions to peel signed from unsigned integer types and
- // either cast or compute the absolute value for the former, depending
- // on __basefield.
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, long __v, const _CharT* __lit,
- ios_base::fmtflags __flags)
- {
- unsigned long __ul = __v;
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
- __ul = __v < 0 ? -__v : __ul;
- return __int_to_char(__bufend, __ul, __lit, __flags, false);
- }
-
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, unsigned long __v, const _CharT* __lit,
- ios_base::fmtflags __flags)
- { return __int_to_char(__bufend, __v, __lit, __flags, false); }
-
-#ifdef _GLIBCXX_USE_LONG_LONG
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, long long __v, const _CharT* __lit,
- ios_base::fmtflags __flags)
- {
- unsigned long long __ull = __v;
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
- __ull = __v < 0 ? -__v : __ull;
- return __int_to_char(__bufend, __ull, __lit, __flags, false);
- }
-
- template<typename _CharT>
- inline int
- __int_to_char(_CharT* __bufend, unsigned long long __v,
- const _CharT* __lit, ios_base::fmtflags __flags)
- { return __int_to_char(__bufend, __v, __lit, __flags, false); }
-#endif
-
- // N.B. The last argument is currently unused (see libstdc++/20914).
template<typename _CharT, typename _ValueT>
int
__int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,
- ios_base::fmtflags __flags, bool)
+ ios_base::fmtflags __flags, bool __dec)
{
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
_CharT* __buf = __bufend;
-
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
+ if (__builtin_expect(__dec, true))
{
// Decimal.
do
@@ -988,7 +941,7 @@ _GLIBCXX_END_LDBL_NAMESPACE
}
while (__v != 0);
}
- else if (__basefield == ios_base::oct)
+ else if ((__flags & ios_base::basefield) == ios_base::oct)
{
// Octal.
do
@@ -1034,7 +987,8 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
_M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,
_ValueT __v) const
{
- typedef __numpunct_cache<_CharT> __cache_type;
+ typedef typename __to_unsigned_type<_ValueT>::__type __unsigned_type;
+ typedef __numpunct_cache<_CharT> __cache_type;
__use_cache<__cache_type> __uc;
const locale& __loc = __io._M_getloc();
const __cache_type* __lc = __uc(__loc);
@@ -1048,7 +1002,11 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
// [22.2.2.2.2] Stage 1, numeric conversion to character.
// Result is returned right-justified in the buffer.
- int __len = __int_to_char(__cs + __ilen, __v, __lit, __flags);
+ const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
+ const bool __dec = (__basefield != ios_base::oct
+ && __basefield != ios_base::hex);
+ const __unsigned_type __u = (__v > 0 || !__dec) ? __v : -__v;
+ int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);
__cs += __ilen - __len;
// Add grouping, if necessary.
@@ -1065,9 +1023,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
}
// Complete Stage 1, prepend numeric base or sign.
- const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
- if (__builtin_expect(__basefield != ios_base::oct
- && __basefield != ios_base::hex, true))
+ if (__builtin_expect(__dec, true))
{
// Decimal.
if (__v > 0)