From 7ef9bed7c378ace785cfe78ed0baaf4777f15fa7 Mon Sep 17 00:00:00 2001 From: paolo Date: Thu, 17 May 2007 09:01:27 +0000 Subject: 2007-05-17 Paolo Carlini * include/bits/locale_facets.tcc (__pad<>::_S_pad): Minor tweaks, avoid unnecessary casts, do widenings just in time. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124790 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/bits/locale_facets.tcc | 29 +++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e7fa7518f4d..27189d6bc1f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2007-05-17 Paolo Carlini + + * include/bits/locale_facets.tcc (__pad<>::_S_pad): Minor tweaks, avoid + unnecessary casts, do widenings just in time. + 2007-05-16 Benjamin Kosnik * acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Add a function diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 481362af15f..1b714adf8fe 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -1200,7 +1200,7 @@ _GLIBCXX_END_LDBL_NAMESPACE // Padding last. if (__adjust == ios_base::left) { - _Traits::copy(__news, const_cast<_CharT*>(__olds), __oldlen); + _Traits::copy(__news, __olds, __oldlen); _Traits::assign(__news + __oldlen, __plen, __fill); return; } @@ -1214,30 +1214,27 @@ _GLIBCXX_END_LDBL_NAMESPACE const locale& __loc = __io._M_getloc(); const ctype<_CharT>& __ctype = use_facet >(__loc); - const bool __testsign = (__ctype.widen('-') == __olds[0] - || __ctype.widen('+') == __olds[0]); - const bool __testhex = (__ctype.widen('0') == __olds[0] - && __oldlen > 1 - && (__ctype.widen('x') == __olds[1] - || __ctype.widen('X') == __olds[1])); - if (__testhex) + if (__ctype.widen('-') == __olds[0] + || __ctype.widen('+') == __olds[0]) { __news[0] = __olds[0]; - __news[1] = __olds[1]; - __mod = 2; - __news += 2; + __mod = 1; + ++__news; } - else if (__testsign) + else if (__ctype.widen('0') == __olds[0] + && __oldlen > 1 + && (__ctype.widen('x') == __olds[1] + || __ctype.widen('X') == __olds[1])) { __news[0] = __olds[0]; - __mod = 1; - ++__news; + __news[1] = __olds[1]; + __mod = 2; + __news += 2; } // else Padding first. } _Traits::assign(__news, __plen, __fill); - _Traits::copy(__news + __plen, const_cast<_CharT*>(__olds + __mod), - __oldlen - __mod); + _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod); } bool -- cgit v1.2.1