From 1434b3bdbc02dc4bb9bdc62b7c4131be0fe4cef0 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 3 Sep 2021 18:07:41 -0700 Subject: [PATCH] sparse cmp: rephrase a comparison to avoid a -Wfloat-equal warning Simply makes it clearer to the compiler what this code is doing. --- lib/sparse/SparseMatrix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sparse/SparseMatrix.c b/lib/sparse/SparseMatrix.c index df0ad6ced..51cfd41fd 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -2023,11 +2023,11 @@ static int cmp(void*i, void*j){ d2 = (nodedata) j; if (d1->dist > d2->dist){ return 1; - } else if (d1->dist == d2->dist){ - return 0; - } else { + } + if (d1->dist < d2->dist) { return -1; } + return 0; } static int Dijkstra_internal(SparseMatrix A, int root, real *dist, int *nlist, int *list, real *dist_max, int *mask){ -- 2.40.0