ctype_members.cc (do_is(mask, wchar_t)): Speed-up for the common case of mask == ctype_base::space...
2005-07-18 Paolo Carlini <pcarlini@suse.de> * config/locale/gnu/ctype_members.cc (do_is(mask, wchar_t)): Speed-up for the common case of mask == ctype_base::space; otherwise, exit the loop earlier if the mask is one of the elementary ones. From-SVN: r102137
This commit is contained in:
parent
eba839f971
commit
39a72a9179
@ -1,3 +1,10 @@
|
||||
2005-07-18 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* config/locale/gnu/ctype_members.cc (do_is(mask, wchar_t)):
|
||||
Speed-up for the common case of mask == ctype_base::space;
|
||||
otherwise, exit the loop earlier if the mask is one of the
|
||||
elementary ones.
|
||||
|
||||
2005-07-14 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
PR libstdc++/21193 (float, double, long double)
|
||||
|
@ -134,20 +134,34 @@ namespace std
|
||||
ctype<wchar_t>::
|
||||
do_is(mask __m, wchar_t __c) const
|
||||
{
|
||||
// Highest bitmask in ctype_base == 10, but extra in "C"
|
||||
// library for blank.
|
||||
// The case of __m == ctype_base::space is particularly important,
|
||||
// due to its use in many istream functions. Therefore we deal with
|
||||
// it first, exploiting the knowledge that on GNU systems _M_bit[5]
|
||||
// is the mask corresponding to ctype_base::space. NB: an encoding
|
||||
// change would not affect correctness!
|
||||
bool __ret = false;
|
||||
const size_t __bitmasksize = 11;
|
||||
for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
|
||||
if (__m & _M_bit[__bitcur]
|
||||
&& __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
|
||||
{
|
||||
__ret = true;
|
||||
break;
|
||||
}
|
||||
if (__m == _M_bit[5])
|
||||
__ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
|
||||
else
|
||||
{
|
||||
// Highest bitmask in ctype_base == 10, but extra in "C"
|
||||
// library for blank.
|
||||
const size_t __bitmasksize = 11;
|
||||
for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
|
||||
if (__m & _M_bit[__bitcur])
|
||||
{
|
||||
if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
|
||||
{
|
||||
__ret = true;
|
||||
break;
|
||||
}
|
||||
else if (__m == _M_bit[__bitcur])
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
|
||||
const wchar_t*
|
||||
ctype<wchar_t>::
|
||||
do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
|
||||
|
Loading…
Reference in New Issue
Block a user