Author: evandro Date: Fri Jun 10 11:00:29 2016 New Revision: 272401 URL: http://llvm.org/viewvc/llvm-project?rev=272401&view=rev Log: [streambuf] Added call to traits_type::copy to common case in xsgetn()
Patch by Laman Sole <laxma...@partner.samsung.com>, Sebastian Pop <s....@samsung.com>, Aditya Kumar <aditya...@samsung.com> Differential Revision: http://reviews.llvm.org/D21103 Modified: libcxx/trunk/include/streambuf Modified: libcxx/trunk/include/streambuf URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/streambuf?rev=272401&r1=272400&r2=272401&view=diff ============================================================================== --- libcxx/trunk/include/streambuf (original) +++ libcxx/trunk/include/streambuf Fri Jun 10 11:00:29 2016 @@ -495,12 +495,22 @@ basic_streambuf<_CharT, _Traits>::xsgetn const int_type __eof = traits_type::eof(); int_type __c; streamsize __i = 0; - for (;__i < __n; ++__i, ++__s) + while(__i < __n) { 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) + { *__s = traits_type::to_char_type(__c); + ++__s; + ++__i; + } else break; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits