summaryrefslogtreecommitdiff
path: root/astro/astrometry/files/patch-util_permutedsort.c
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2016-07-26 16:51:15 +0000
committerMathieu Arnold <mat@FreeBSD.org>2016-07-26 16:51:15 +0000
commit9fa9eb9ac7bf1d3de825ee25a8f0ae81b7b77896 (patch)
tree9b071a8105704e992946dcd6b801e9fcb7635142 /astro/astrometry/files/patch-util_permutedsort.c
parentMooseFS is a Fault tolerant, High Available, Highly Performing, Scale-Out, (diff)
Cleanup patches, a* categories.
Rename them to follow the make makepatch naming, and regenerate them. With hat: portmgr Sponsored by: Absolight
Diffstat (limited to 'astro/astrometry/files/patch-util_permutedsort.c')
-rw-r--r--astro/astrometry/files/patch-util_permutedsort.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/astro/astrometry/files/patch-util_permutedsort.c b/astro/astrometry/files/patch-util_permutedsort.c
new file mode 100644
index 000000000000..82962a23a40e
--- /dev/null
+++ b/astro/astrometry/files/patch-util_permutedsort.c
@@ -0,0 +1,31 @@
+--- util/permutedsort.c.orig 2015-12-12 19:02:27 UTC
++++ util/permutedsort.c
+@@ -92,6 +92,12 @@ int* permuted_sort(const void* realarray
+ if (isnan(d2)) return -1; \
+ assert(0); return 0;
+
++#define COMPARE_INT(d1, d2, op1, op2) \
++ if (d1 op1 d2) return -1; \
++ if (d1 op2 d2) return 1; \
++ if (d1 == d2) return 0; \
++ assert(0); return 0;
++
+ //printf("d1=%g, d2=%g\n", d1, d2);
+
+ int compare_doubles_asc(const void* v1, const void* v2) {
+@@ -122,13 +128,13 @@ int compare_floats_desc(const void* v1,
+ int compare_int64_asc(const void* v1, const void* v2) {
+ int64_t f1 = *(int64_t*)v1;
+ int64_t f2 = *(int64_t*)v2;
+- COMPARE(f1, f2, <, >);
++ COMPARE_INT(f1, f2, <, >);
+ }
+
+ int compare_int64_desc(const void* v1, const void* v2) {
+ int64_t f1 = *(int64_t*)v1;
+ int64_t f2 = *(int64_t*)v2;
+- COMPARE(f1, f2, >, <);
++ COMPARE_INT(f1, f2, >, <);
+ }
+
+ // Versions for use with QSORT_R