From: Matthew Fernandez Date: Sun, 18 Sep 2022 16:41:12 +0000 (-0700) Subject: topfish fill_neighbors_vec: use 'fabsf' instead of casting to float X-Git-Tag: 6.0.2~32^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=99b4a5cd2be269df355194dc96613d8e9261cbd0;p=graphviz topfish fill_neighbors_vec: use 'fabsf' instead of casting to float This is simpler and more efficient when both the input and the desired output type are floats. --- diff --git a/lib/topfish/hierarchy.c b/lib/topfish/hierarchy.c index b4fd1fd62..7ae51bdf9 100644 --- a/lib/topfish/hierarchy.c +++ b/lib/topfish/hierarchy.c @@ -60,7 +60,7 @@ static void fill_neighbors_vec(v_data *graph, int vtx, float *vtx_vec) { int j; if (graph[0].ewgts != NULL) { for (j = 0; j < graph[vtx].nedges; j++) { - vtx_vec[graph[vtx].edges[j]] = (float) fabs(graph[vtx].ewgts[j]); // use fabs for the self loop + vtx_vec[graph[vtx].edges[j]] = fabsf(graph[vtx].ewgts[j]); // use fabsf for the self loop } } else { for (j = 0; j < graph[vtx].nedges; j++) {