[streambuf] Added call to traits_type::copy to common case in xsgetn()
Patch by Laman Sole <laxman.g@partner.samsung.com>, Sebastian Pop <s.pop@samsung.com>, Aditya Kumar <aditya.k7@samsung.com> Differential Revision: http://reviews.llvm.org/D21103 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272401 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -495,12 +495,22 @@ basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n)
|
|||||||
const int_type __eof = traits_type::eof();
|
const int_type __eof = traits_type::eof();
|
||||||
int_type __c;
|
int_type __c;
|
||||||
streamsize __i = 0;
|
streamsize __i = 0;
|
||||||
for (;__i < __n; ++__i, ++__s)
|
while(__i < __n)
|
||||||
{
|
{
|
||||||
if (__ninp_ < __einp_)
|
if (__ninp_ < __einp_)
|
||||||
*__s = *__ninp_++;
|
{
|
||||||
|
const streamsize __len = _VSTD::min(__einp_ - __ninp_, __n - __i);
|
||||||
|
traits_type::copy(__s, __ninp_, __len);
|
||||||
|
__s += __len;
|
||||||
|
__i += __len;
|
||||||
|
this->gbump(__len);
|
||||||
|
}
|
||||||
else if ((__c = uflow()) != __eof)
|
else if ((__c = uflow()) != __eof)
|
||||||
|
{
|
||||||
*__s = traits_type::to_char_type(__c);
|
*__s = traits_type::to_char_type(__c);
|
||||||
|
++__s;
|
||||||
|
++__i;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user