locale_facets.tcc (num_get::_M_extract_int): Slightly streamline the code dealing with overflows and the parsing of the sign.
2003-12-09 Paolo Carlini <pcarlini@suse.de> * include/bits/locale_facets.tcc (num_get::_M_extract_int): Slightly streamline the code dealing with overflows and the parsing of the sign. From-SVN: r74476
This commit is contained in:
parent
579ed98749
commit
1f3adac20c
|
@ -1,3 +1,9 @@
|
||||||
|
2003-12-09 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* include/bits/locale_facets.tcc (num_get::_M_extract_int):
|
||||||
|
Slightly streamline the code dealing with overflows and the
|
||||||
|
parsing of the sign.
|
||||||
|
|
||||||
2003-12-09 Bernardo Innocenti <bernie@develer.com>
|
2003-12-09 Bernardo Innocenti <bernie@develer.com>
|
||||||
|
|
||||||
* include/ext/algorithm, include/ext/debug_allocator.h,
|
* include/ext/algorithm, include/ext/debug_allocator.h,
|
||||||
|
|
|
@ -283,9 +283,9 @@ namespace std
|
||||||
bool __negative = false;
|
bool __negative = false;
|
||||||
if (__beg != __end)
|
if (__beg != __end)
|
||||||
{
|
{
|
||||||
|
if (numeric_limits<_ValueT>::is_signed)
|
||||||
__negative = __traits_type::eq(*__beg, __lit[_S_iminus]);
|
__negative = __traits_type::eq(*__beg, __lit[_S_iminus]);
|
||||||
if (__negative && numeric_limits<_ValueT>::is_signed
|
if (__negative || __traits_type::eq(*__beg, __lit[_S_iplus]))
|
||||||
|| __traits_type::eq(*__beg, __lit[_S_iplus]))
|
|
||||||
++__beg;
|
++__beg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,8 +353,7 @@ namespace std
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const _ValueT __new_result = __result * __base - __digit;
|
const _ValueT __new_result = __result * __base - __digit;
|
||||||
if (__result)
|
__overflow |= __new_result > __result;
|
||||||
__overflow |= __new_result >= __result;
|
|
||||||
__result = __new_result;
|
__result = __new_result;
|
||||||
++__sep_pos;
|
++__sep_pos;
|
||||||
__found_num = true;
|
__found_num = true;
|
||||||
|
@ -398,8 +397,7 @@ namespace std
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const _ValueT __new_result = __result * __base + __digit;
|
const _ValueT __new_result = __result * __base + __digit;
|
||||||
if (__result)
|
__overflow |= __new_result < __result;
|
||||||
__overflow |= __new_result <= __result;
|
|
||||||
__result = __new_result;
|
__result = __new_result;
|
||||||
++__sep_pos;
|
++__sep_pos;
|
||||||
__found_num = true;
|
__found_num = true;
|
||||||
|
@ -436,8 +434,8 @@ namespace std
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(__err & ios_base::failbit)
|
if (!(__err & ios_base::failbit) && !__overflow
|
||||||
&& !__overflow && __found_num)
|
&& __found_num)
|
||||||
__v = __result;
|
__v = __result;
|
||||||
else
|
else
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
|
|
Loading…
Reference in New Issue