summaryrefslogtreecommitdiff
path: root/h/sort.h
diff options
context:
space:
mode:
Diffstat (limited to 'h/sort.h')
-rw-r--r--h/sort.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/h/sort.h b/h/sort.h
index 98bee8f..8440425 100644
--- a/h/sort.h
+++ b/h/sort.h
@@ -1,4 +1,6 @@
+#ifndef SORT_H
+
/*
* Copyright 1996 - 2010 Graeme W. Gill
* All rights reserved.
@@ -7,13 +9,17 @@
* see the License2.txt file for licencing details.
*/
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
/*
* Heapsort macro - sort smallest to largest.
* Heapsort is guaranteed nlogn, doesn't need any
* extra storage, but often isn't as fast as quicksort.
*/
-/* Need to #define HEAP_COMPARE(A,B) so it returns true if A < B */
+/* To sort ascenting, need to #define HEAP_COMPARE(A,B) so it returns true if A < B */
/* Note that A will be ARRAY[a], and B will be ARRAY[b] where a and b are indexes. */
/* TYPE should be the type of each entry of the ARRAY */
#define HEAPSORT(TYPE,ARRAY,NUMBER) \
@@ -60,3 +66,9 @@
} \
}
+#ifdef __cplusplus
+ }
+#endif
+
+#define SORT_H
+#endif /* SORT_H */