summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-24 11:20:55 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-24 11:20:55 +0000
commitfd7beb09c075043baec7715b8fb28b769432e260 (patch)
tree7c80c4dc55c9b793e8dae24023afb7f0cc776837 /libstdc++-v3
parentcbb580fe3135926c2963351cfc124cf985b0bb8a (diff)
downloadgcc-fd7beb09c075043baec7715b8fb28b769432e260.tar.gz
2003-10-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (money_get::do_get(..., string_type&): Disregard the previous commit: doesn't hurt but doesn't accomplish anything useful either. This is the right one, speeding up greatly the function in case of early fail. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72888 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc79
2 files changed, 48 insertions, 38 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 16b221b8db5..7842ab56f78 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,6 +1,13 @@
2003-10-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (money_get::do_get(...,
+ string_type&): Disregard the previous commit: doesn't hurt but
+ doesn't accomplish anything useful either. This is the right
+ one, speeding up greatly the function in case of early fail.
+
+2003-10-24 Paolo Carlini <pcarlini@suse.de>
+
+ * include/bits/locale_facets.tcc (money_get::do_get(...,
string_type&): Move an if block, thus minimizing the amount
of code processed anyway when __tmp_units.size() == 0.
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index ca9ad0510d6..f025c5125a9 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -1270,44 +1270,6 @@ namespace std
}
}
- const char_type __zero = __ctype.widen('0');
-
- // Strip leading zeros.
- if (__tmp_units.size() > 1)
- {
- const size_type __first = __tmp_units.find_first_not_of(__zero);
- const bool __only_zeros = __first == string_type::npos;
- if (__first)
- __tmp_units.erase(0, __only_zeros ? __tmp_units.size() - 1
- : __first);
- }
-
- if (__tmp_units.size())
- {
- // 22.2.6.1.2, p4
- if (__sign.size() && __sign == __neg_sign
- && __tmp_units[0] != __zero)
- __tmp_units.insert(__tmp_units.begin(), __ctype.widen('-'));
-
- // Test for grouping fidelity.
- if (__grouping.size() && __grouping_tmp.size())
- {
- if (!std::__verify_grouping(__grouping, __grouping_tmp))
- __testvalid = false;
- }
-
- // Iff not enough digits were supplied after the decimal-point.
- if (__testdecfound)
- {
- const int __frac = __intl ? __mpt.frac_digits()
- : __mpf.frac_digits();
- if (__frac > 0 && __sep_pos != __frac)
- __testvalid = false;
- }
- }
- else
- __testvalid = false;
-
// Need to get the rest of the sign characters, if they exist.
const char_type __eof = static_cast<char_type>(char_traits<char_type>::eof());
if (__sign.size() > 1)
@@ -1322,6 +1284,47 @@ namespace std
__testvalid = false;
}
+ if (__testvalid)
+ {
+ const char_type __zero = __ctype.widen('0');
+
+ // Strip leading zeros.
+ if (__tmp_units.size() > 1)
+ {
+ const size_type __first = __tmp_units.find_first_not_of(__zero);
+ const bool __only_zeros = __first == string_type::npos;
+ if (__first)
+ __tmp_units.erase(0, __only_zeros ? __tmp_units.size() - 1
+ : __first);
+ }
+
+ if (__tmp_units.size())
+ {
+ // 22.2.6.1.2, p4
+ if (__sign.size() && __sign == __neg_sign
+ && __tmp_units[0] != __zero)
+ __tmp_units.insert(__tmp_units.begin(), __ctype.widen('-'));
+
+ // Test for grouping fidelity.
+ if (__grouping.size() && __grouping_tmp.size())
+ {
+ if (!std::__verify_grouping(__grouping, __grouping_tmp))
+ __testvalid = false;
+ }
+
+ // Iff not enough digits were supplied after the decimal-point.
+ if (__testdecfound)
+ {
+ const int __frac = __intl ? __mpt.frac_digits()
+ : __mpf.frac_digits();
+ if (__frac > 0 && __sep_pos != __frac)
+ __testvalid = false;
+ }
+ }
+ else
+ __testvalid = false;
+ }
+
// Iff no more characters are available.
if (__c == __eof)
__err |= ios_base::eofbit;