Permalink
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/pmc/fixedfloatarray.pmc
View
5 src/pmc/fixedfloatarray.pmc
@@ -594,9 +594,8 @@ static int
auxcmpfunc(ARGIN(const FLOATVAL *i), ARGIN(const FLOATVAL *j))
{
ASSERT_ARGS(auxcmpfunc)
- if (*i == *j) return 0;
- if (*i < *j) return -1;
- else return 1;
+
+ return (*i < *j) ? -1 : (*i > *j);
}
/*

1 comment on commit 94e7f64

@gerdr

For what it's worth, the C idiom for tri-state comparisons is

(*i > *j) - (*i < *j)

which is a well-known way to avoid integer overflow

Please sign in to comment.