mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-02 08:13:58 +08:00
streambuf.tcc (sbumpc, [...]): Move inline, from here...
2003-06-25 Nathan C. Myers <ncm-nospam@cantrip.org> * include/bits/streambuf.tcc (sbumpc, sputbackc, sungetc, sputc): Move inline, from here... * include/std/std_streambuf.h: ... to here. * include/std/std_streambuf.h (snextc, sbumpc, sgetc, sputbackc, sungetc, sputc): Use __builtin_expect. From-SVN: r68486
This commit is contained in:
parent
b1dcf523e9
commit
29d9ed9799
@ -1,3 +1,12 @@
|
||||
2003-06-25 Nathan C. Myers <ncm-nospam@cantrip.org>
|
||||
|
||||
* include/bits/streambuf.tcc (sbumpc, sputbackc, sungetc,
|
||||
sputc): Move inline, from here...
|
||||
* include/std/std_streambuf.h: ... to here.
|
||||
|
||||
* include/std/std_streambuf.h (snextc, sbumpc, sgetc,
|
||||
sputbackc, sungetc, sputc): Use __builtin_expect.
|
||||
|
||||
2003-06-24 Phil Edwards <pme@gcc.gnu.org>
|
||||
|
||||
* docs/doxygen/mainpage.html: Use a useful title.
|
||||
|
@ -39,72 +39,6 @@
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::int_type
|
||||
basic_streambuf<_CharT, _Traits>::
|
||||
sbumpc()
|
||||
{
|
||||
int_type __ret;
|
||||
if (this->gptr() < this->egptr())
|
||||
{
|
||||
__ret = traits_type::to_int_type(*this->gptr());
|
||||
this->gbump(1);
|
||||
}
|
||||
else
|
||||
__ret = this->uflow();
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::int_type
|
||||
basic_streambuf<_CharT, _Traits>::
|
||||
sputbackc(char_type __c)
|
||||
{
|
||||
int_type __ret;
|
||||
const bool __testpos = this->eback() < this->gptr();
|
||||
if (!__testpos || !traits_type::eq(__c, this->gptr()[-1]))
|
||||
__ret = this->pbackfail(traits_type::to_int_type(__c));
|
||||
else
|
||||
{
|
||||
this->gbump(-1);
|
||||
__ret = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::int_type
|
||||
basic_streambuf<_CharT, _Traits>::
|
||||
sungetc()
|
||||
{
|
||||
int_type __ret;
|
||||
if (this->eback() < this->gptr())
|
||||
{
|
||||
this->gbump(-1);
|
||||
__ret = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
else
|
||||
__ret = this->pbackfail();
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::int_type
|
||||
basic_streambuf<_CharT, _Traits>::
|
||||
sputc(char_type __c)
|
||||
{
|
||||
int_type __ret;
|
||||
if (this->pptr() < this->epptr())
|
||||
{
|
||||
*this->pptr() = __c;
|
||||
this->pbump(1);
|
||||
__ret = traits_type::to_int_type(__c);
|
||||
}
|
||||
else
|
||||
__ret = this->overflow(traits_type::to_int_type(__c));
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
streamsize
|
||||
basic_streambuf<_CharT, _Traits>::
|
||||
|
@ -287,7 +287,8 @@ namespace std
|
||||
snextc()
|
||||
{
|
||||
int_type __ret = traits_type::eof();
|
||||
if (!traits_type::eq_int_type(this->sbumpc(), __ret))
|
||||
if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(),
|
||||
__ret), true))
|
||||
__ret = this->sgetc();
|
||||
return __ret;
|
||||
}
|
||||
@ -301,7 +302,18 @@ namespace std
|
||||
* @c uflow().
|
||||
*/
|
||||
int_type
|
||||
sbumpc();
|
||||
sbumpc()
|
||||
{
|
||||
int_type __ret;
|
||||
if (__builtin_expect(this->gptr() < this->egptr(), true))
|
||||
{
|
||||
__ret = traits_type::to_int_type(*this->gptr());
|
||||
this->gbump(1);
|
||||
}
|
||||
else
|
||||
__ret = this->uflow();
|
||||
return __ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Getting the next character.
|
||||
@ -315,7 +327,7 @@ namespace std
|
||||
sgetc()
|
||||
{
|
||||
int_type __ret;
|
||||
if (this->gptr() < this->egptr())
|
||||
if (__builtin_expect(this->gptr() < this->egptr(), true))
|
||||
__ret = traits_type::to_int_type(*this->gptr());
|
||||
else
|
||||
__ret = this->underflow();
|
||||
@ -345,7 +357,20 @@ namespace std
|
||||
* fetched from the input stream will be @a c.
|
||||
*/
|
||||
int_type
|
||||
sputbackc(char_type __c);
|
||||
sputbackc(char_type __c)
|
||||
{
|
||||
int_type __ret;
|
||||
const bool __testpos = this->eback() < this->gptr();
|
||||
if (__builtin_expect(!__testpos ||
|
||||
!traits_type::eq(__c, this->gptr()[-1]), false))
|
||||
__ret = this->pbackfail(traits_type::to_int_type(__c));
|
||||
else
|
||||
{
|
||||
this->gbump(-1);
|
||||
__ret = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Moving backwards in the input stream.
|
||||
@ -357,7 +382,18 @@ namespace std
|
||||
* "gotten".
|
||||
*/
|
||||
int_type
|
||||
sungetc();
|
||||
sungetc()
|
||||
{
|
||||
int_type __ret;
|
||||
if (__builtin_expect(this->eback() < this->gptr(), true))
|
||||
{
|
||||
this->gbump(-1);
|
||||
__ret = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
else
|
||||
__ret = this->pbackfail();
|
||||
return __ret;
|
||||
}
|
||||
|
||||
// [27.5.2.2.5] put area
|
||||
/**
|
||||
@ -373,7 +409,19 @@ namespace std
|
||||
* position is not available, returns @c overflow(c).
|
||||
*/
|
||||
int_type
|
||||
sputc(char_type __c);
|
||||
sputc(char_type __c)
|
||||
{
|
||||
int_type __ret;
|
||||
if (__builtin_expect(this->pptr() < this->epptr(), true))
|
||||
{
|
||||
*this->pptr() = __c;
|
||||
this->pbump(1);
|
||||
__ret = traits_type::to_int_type(__c);
|
||||
}
|
||||
else
|
||||
__ret = this->overflow(traits_type::to_int_type(__c));
|
||||
return __ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Entry point for all single-character output functions.
|
||||
|
Loading…
Reference in New Issue
Block a user