]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sstream.tcc: Clean up bit ops.
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 9 Apr 2002 08:48:33 +0000 (08:48 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 9 Apr 2002 08:48:33 +0000 (08:48 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fstream.tcc
libstdc++-v3/include/bits/sstream.tcc

index 38721167630aa40ebd13a47c68a4451e846078e7..11445dbd869e0962408d78b0007e39d5420fc189 100644 (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.
index 0117d57fc4c9b0ea3f52cb4da1ff9bc2dd897330..92a0730d67b81b7a0e6a43cbf8c8540bf05a2a4c 100644 (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();
index 6aec6e8558aa23d2e3b79093b1a67f9bd8a6d761..e7419504d3e548069b9d3b81de3ba5feb36d251c 100644 (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);