]> granicus.if.org Git - graphviz/commitdiff
replace unnecessary max() implementation with libc fmaxf
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 23 Mar 2021 04:15:08 +0000 (21:15 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 29 Mar 2021 04:47:25 +0000 (21:47 -0700)
No need to hand roll this ourselves now that we compile with C99.

lib/neatogen/stress.c

index 1d87f8174a4c3f2a665a94a778291487d61b0369..4cbae1583b51c56bc125719a09e1143fc9c84697 100644 (file)
@@ -788,8 +788,6 @@ float *compute_apsp_packed(vtx_data * graph, int n)
     return Dij;
 }
 
-#define max(x,y) ((x)>(y)?(x):(y))
-
 float *compute_apsp_artifical_weights_packed(vtx_data * graph, int n)
 {
     /* compute all-pairs-shortest-path-length while weighting the graph */
@@ -820,12 +818,8 @@ float *compute_apsp_artifical_weights_packed(vtx_data * graph, int n)
            for (j = 1; j <= deg_i; j++) {
                neighbor = graph[i].edges[j];
                deg_j = graph[neighbor].nedges - 1;
-               weights[j] = (float)
-                   max((float)
-                       (deg_i + deg_j -
-                        2 * common_neighbors(graph, i, neighbor,
-                                             vtx_vec)),
-                       graph[i].ewgts[j]);
+               weights[j] = fmaxf((float)(deg_i + deg_j -
+                        2 * common_neighbors(graph, i, neighbor, vtx_vec)), graph[i].ewgts[j]);
            }
            empty_neighbors_vec(graph, i, vtx_vec);
            graph[i].ewgts = weights;