diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 38721167630..11445dbd869 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2002-04-09 Benjamin Kosnik + Richard Henderson + + * include/bits/sstream.tcc: Clean up bit ops. + * include/bits/fstream.tcc: Same. + 2002-04-09 Jakub Jelinek * include/bits/locale_facets.h (__num_base::_S_scale_hex): Remove. diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 0117d57fc4c..92a0730d67b 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -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(); diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc index 6aec6e8558a..e7419504d3e 100644 --- a/libstdc++-v3/include/bits/sstream.tcc +++ b/libstdc++-v3/include/bits/sstream.tcc @@ -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);