]> gcc.gnu.org Git - gcc.git/commitdiff
random.tcc (subtract_with_carry_01<>:: seed(_Gen&, false_type)): Fix _M_carry initial...
authorPaolo Carlini <pcarlini@suse.de>
Tue, 22 Aug 2006 22:57:53 +0000 (22:57 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 22 Aug 2006 22:57:53 +0000 (22:57 +0000)
2006-08-22  Paolo Carlini  <pcarlini@suse.de>

* include/tr1/random.tcc (subtract_with_carry_01<>::
       seed(_Gen&, false_type)): Fix _M_carry initialization.

* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/cons/default.cc: Qualify 1 as 1UL.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/cons/gen1.cc: Likewise.

From-SVN: r116334

libstdc++-v3/ChangeLog
libstdc++-v3/include/tr1/random.tcc
libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/default.cc
libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc

index 8fcab061b9707575a2e1990e1dbcb8991971c27a..988334718afa1d44155e8d474d40f9860e06d978 100644 (file)
@@ -1,3 +1,13 @@
+2006-08-22  Paolo Carlini  <pcarlini@suse.de>
+
+       * include/tr1/random.tcc (subtract_with_carry_01<>::
+       seed(_Gen&, false_type)): Fix _M_carry initialization.
+       
+       * testsuite/tr1/5_numerical_facilities/random/
+       subtract_with_carry/cons/default.cc: Qualify 1 as 1UL.
+       * testsuite/tr1/5_numerical_facilities/random/
+       subtract_with_carry/cons/gen1.cc: Likewise.
+
 2006-08-22  Paolo Carlini  <pcarlini@suse.de>
 
        * include/tr1/random (class subtract_with_carry_01<>): Add.
index 2880aad580e762d3ccb2da5ced837f0e232aa895..cbeb57d82d33bd22f2b771fbf4ceb98c766c9404 100644 (file)
@@ -484,7 +484,15 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
            _M_x[__i][__n - 1] = __mod<_UInt32Type, 1, 0,
              _Shift<_UInt32Type, __w % 32>::__value>(__gen());
          }
-       _M_carry = (_M_x[long_lag - 1][0] == 0) ? 1 : 0;
+
+       _M_carry = 1;
+       for (int __j = 0; __j < __n; ++__j)
+         if (_M_x[long_lag - 1][__j] != 0)
+           {
+             _M_carry = 0;
+             break;
+           }
+
        _M_p = 0;
 
        // Initialize the array holding the negative powers of 2.
index 466354124fcf4abe36964e19c21905ac52b1e610..b87871d48d394237e331cb8e29b150114346054c 100644 (file)
@@ -32,7 +32,7 @@ test01()
 
   subtract_with_carry<unsigned long, (1UL << 24), 10, 24> x;
   VERIFY( x.min() == 0 );
-  VERIFY( x.max() == ((1<<24)-1) );
+  VERIFY( x.max() == ((1UL << 24) - 1) );
   VERIFY( x() == 15039276 );
 }
 
index cacde1b8e36d58a51bdafdb43a90c915c7efaf9b..509144563c3a29bf8d9d2e84d44b89a6619792c9 100644 (file)
@@ -40,7 +40,7 @@ test01()
 
   subtract_with_carry<unsigned long, (1UL << 24), 10, 24> x(gen);
   VERIFY( x.min() == 0 );
-  VERIFY( x.max() == ((1 << 24) - 1) );
+  VERIFY( x.max() == ((1UL << 24) - 1) );
 }
 
 int main()
This page took 0.081028 seconds and 5 git commands to generate.