Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75764 - trunk/boost/random/detail
From: steven_at_[hidden]
Date: 2011-12-01 13:33:14


Author: steven_watanabe
Date: 2011-12-01 13:33:13 EST (Thu, 01 Dec 2011)
New Revision: 75764
URL: http://svn.boost.org/trac/boost/changeset/75764

Log:
Fix off-by-one error. Fixes #6189.
Text files modified:
   trunk/boost/random/detail/signed_unsigned_tools.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/boost/random/detail/signed_unsigned_tools.hpp
==============================================================================
--- trunk/boost/random/detail/signed_unsigned_tools.hpp (original)
+++ trunk/boost/random/detail/signed_unsigned_tools.hpp 2011-12-01 13:33:13 EST (Thu, 01 Dec 2011)
@@ -73,7 +73,7 @@
     if (y >= 0)
       return T2(x) + y;
     // y < 0
- if (x >= T1(-(y+1))) // result >= 0 after subtraction
+ if (x > T1(-(y+1))) // result >= 0 after subtraction
       // avoid the nasty two's complement edge case for y == min()
       return T2(x - T1(-(y+1)) - 1);
     // abs(x) < abs(y), thus T2 able to represent x


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk