[Commit] nickle/examples apsp.5c,1.1,1.2

Bart Massey commit at keithp.com
Sun Aug 22 16:45:35 PDT 2004


Committed by: bart

Update of /local/src/CVS/nickle/examples
In directory home.keithp.com:/tmp/cvs-serv29601/examples

Modified Files:
	apsp.5c 
Log Message:
* builtin-file.c:
don't allow bases smaller than 2 in do_File_print().
Closes bug report by Clem Taylor <clemtaylor at comcast.net>.
	


Index: apsp.5c
===================================================================
RCS file: /local/src/CVS/nickle/examples/apsp.5c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- apsp.5c	23 Jun 2004 09:00:46 -0000	1.1
+++ apsp.5c	22 Aug 2004 23:45:32 -0000	1.2
@@ -23,9 +23,10 @@
 	  {{{dist = -1, first_hop = -1}, ...},...};
 	for (int i = 0; i < n; i++) {
 	    for (int j = 0; j < n; j++) {
-		path[i,j].dist = adjacencies[i,j];
-		if (i != j && adjacencies[i,j] >= 0)
+		if (i != j && adjacencies[i,j] >= 0) {
+		    path[i,j].dist = adjacencies[i,j];
 		    path[i,j].first_hop = j;
+		}
 	    }
 	}
 	/* do the computation */
@@ -36,10 +37,10 @@
 			continue;
 		    real dik = path[i,k].dist;
 		    real dkj = path[k,j].dist;
-		    if (dik <= 0 || dkj <= 0)
+		    if (dik < 0 || dkj < 0)
 			continue;
 		    real dij = path[i,j].dist;
-		    if (dij <= 0 || dik + dkj < dij) {
+		    if (dij < 0 || dik + dkj < dij) {
 			path[i,j].dist = dik + dkj;
 			path[i,j].first_hop = path[i,k].first_hop;
 		    }




More information about the Commit mailing list