sstream.tcc: Clean up bit ops.

2002-04-09  Benjamin Kosnik  <bkoz@redhat.com>
	    Richard Henderson  <rth@redhat.com>

	* include/bits/sstream.tcc: Clean up bit ops.
	* include/bits/fstream.tcc: Same.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r52070
This commit is contained in:
Benjamin Kosnik 2002-04-09 08:48:33 +00:00 committed by Benjamin Kosnik
parent b0396e3b6c
commit dcf5a5dec8
3 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2002-04-09 Benjamin Kosnik <bkoz@redhat.com>
Richard Henderson <rth@redhat.com>
* include/bits/sstream.tcc: Clean up bit ops.
* include/bits/fstream.tcc: Same.
2002-04-09 Jakub Jelinek <jakub@redhat.com>
* include/bits/locale_facets.h (__num_base::_S_scale_hex): Remove.

View File

@ -560,8 +560,8 @@ namespace std
seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
{
pos_type __ret = pos_type(off_type(-1));
bool __testin = _M_mode & ios_base::in;
bool __testout = _M_mode & ios_base::out;
bool __testin = (ios_base::in & _M_mode & __mode) != 0;
bool __testout = (ios_base::out & _M_mode & __mode) != 0;
// Should probably do has_facet checks here.
int __width = use_facet<__codecvt_type>(_M_buf_locale).encoding();
@ -569,8 +569,7 @@ namespace std
__width = 0;
bool __testfail = __off != 0 && __width <= 0;
if (this->is_open() && !__testfail
&& __mode & _M_mode && (__testin || __testout))
if (this->is_open() && !__testfail && (__testin || __testout))
{
// Ditch any pback buffers to avoid confusion.
_M_pback_destroy();

View File

@ -121,8 +121,8 @@ namespace std
seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
{
pos_type __ret = pos_type(off_type(-1));
bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
bool __testin = (ios_base::in & _M_mode & __mode) != 0;
bool __testout = (ios_base::out & _M_mode & __mode) != 0;
bool __testboth = __testin && __testout && __way != ios_base::cur;
__testin &= !(__mode & ios_base::out);
__testout &= !(__mode & ios_base::in);
@ -187,8 +187,8 @@ namespace std
off_type __pos = __sp._M_position();
char_type* __beg = NULL;
char_type* __end = NULL;
bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
bool __testin = (ios_base::in & _M_mode & __mode) != 0;
bool __testout = (ios_base::out & _M_mode & __mode) != 0;
bool __testboth = __testin && __testout;
__testin &= !(__mode & ios_base::out);
__testout &= !(__mode & ios_base::in);