Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80639 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2012-09-22 15:32:32


Author: jewillco
Date: 2012-09-22 15:32:32 EDT (Sat, 22 Sep 2012)
New Revision: 80639
URL: http://svn.boost.org/trac/boost/changeset/80639

Log:
Fixed relax logic to not write predecessor map unless distance was actually changed in memory (although this case will never be hit unless registers have extra precision compared to memory); fixes #7226
Text files modified:
   trunk/boost/graph/relax.hpp | 23 ++++++++++++++++-------
   1 files changed, 16 insertions(+), 7 deletions(-)

Modified: trunk/boost/graph/relax.hpp
==============================================================================
--- trunk/boost/graph/relax.hpp (original)
+++ trunk/boost/graph/relax.hpp 2012-09-22 15:32:32 EDT (Sat, 22 Sep 2012)
@@ -53,17 +53,26 @@
       const D d_v = get(d, v);
       const W& w_e = get(w, e);
       
- // The redundant gets in the return statements are to ensure that extra
- // floating-point precision in x87 registers does not lead to relax()
- // returning true when the distance did not actually change.
+ // The seemingly redundant comparisons after the distance puts are to
+ // ensure that extra floating-point precision in x87 registers does not
+ // lead to relax() returning true when the distance did not actually
+ // change.
       if ( compare(combine(d_u, w_e), d_v) ) {
         put(d, v, combine(d_u, w_e));
- put(p, v, u);
- return compare(get(d, v), d_v);
+ if (compare(get(d, v), d_v)) {
+ put(p, v, u);
+ return true;
+ } else {
+ return false;
+ }
       } else if (is_undirected && compare(combine(d_v, w_e), d_u)) {
         put(d, u, combine(d_v, w_e));
- put(p, u, v);
- return compare(get(d, u), d_u);
+ if (compare(get(d, u), d_u)) {
+ put(p, u, v);
+ return true;
+ } else {
+ return false;
+ }
       } else
         return false;
     }


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