Browse files

Hopefully fix FFA.sort() bug, caused by my questionable casting. @nwe…

  • Loading branch information...
1 parent ea40261 commit 8c9a371055d90fd477ae2465b306c7723a474cb4 @leto leto committed Jan 15, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/pmc/fixedfloatarray.pmc
View
6 src/pmc/fixedfloatarray.pmc
@@ -583,7 +583,7 @@ Reverse the contents of the array.
=item C<static int auxcmpfunc(const FLOATVAL *i, const FLOATVAL *j)>
-INTVAL compare function for qsort usage.
+FLOATVAL compare function for qsort usage.
=cut
@@ -594,7 +594,9 @@ static int
auxcmpfunc(ARGIN(const FLOATVAL *i), ARGIN(const FLOATVAL *j))
{
ASSERT_ARGS(auxcmpfunc)
- return (int) (*i - *j);
+ if (*i == *j) return 0;
+ if (*i < *j) return -1;
+ else return 1;
}
/*

0 comments on commit 8c9a371

Please sign in to comment.