Update of /cvsroot/boost/boost/boost/random/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24504

Modified Files:
        const_mod.hpp 
Log Message:
fix bug 1505014: avoid signed overflow in modular addition


Index: const_mod.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/random/detail/const_mod.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- const_mod.hpp       27 Jul 2004 03:43:32 -0000      1.8
+++ const_mod.hpp       29 Jun 2006 23:17:14 -0000      1.9
@@ -43,10 +43,10 @@
     template<class IntType>
     static IntType add(IntType m, IntType x, IntType c)
     {
-      x += (c-m);
-      if(x < 0)
-        x += m;
-      return x;
+      if (x < m - c)
+        return x + c;
+      else
+        return x - (m-c);
     }
   };
 


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to