Index: courgette/third_party/divsufsort/divsufsort.h |
diff --git a/courgette/third_party/divsufsort/divsufsort.h b/courgette/third_party/divsufsort/divsufsort.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..54112f446ea1fbd0862cc9e9c33c464c01b24e31 |
--- /dev/null |
+++ b/courgette/third_party/divsufsort/divsufsort.h |
@@ -0,0 +1,54 @@ |
+// Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. |
+// |
+// For the terms under which this work may be distributed, please see |
+// the adjoining file "LICENSE". |
+// |
+// ChangeLog: |
+// 2016-07-22 - Initial commit and adaption to use PagedArray. |
+// --Samuel Huang <huangs@chromium.org> |
+ |
+#ifndef COURGETTE_BSDIFF_THIRD_PARTY_DIVSUFSORT_H_ |
+#define COURGETTE_BSDIFF_THIRD_PARTY_DIVSUFSORT_H_ |
+ |
+#include <stdint.h> |
+ |
+#include "courgette/third_party/bsdiff/paged_array.h" |
+ |
+namespace divsuf { |
+ |
+/*- Datatypes -*/ |
+typedef int32_t saint_t; |
+typedef int32_t saidx_t; |
+typedef uint8_t sauchar_t; |
+ |
+#ifdef DIVSUFSORT_NO_PAGED_ARRAY |
+typedef saidx_t* saidx_it; |
+typedef const saidx_t* const_saidx_it; |
+#else |
+typedef courgette::PagedArray<saidx_t>::iterator saidx_it; |
+typedef courgette::PagedArray<saidx_t>::const_iterator const_saidx_it; |
+#endif |
+ |
+/*- Prototypes -*/ |
+ |
+/** |
+ * Constructs the suffix array of a given string, excluding the empty string. |
+ * @param T[0..n-1] The input string. |
+ * @param SA[0..n-1] The output array of suffixes. |
+ * @param n The length of the given string. |
+ * @return 0 if no error occurred, -1 or -2 otherwise. |
+ */ |
+saint_t divsufsort(const sauchar_t *T, saidx_it SA, saidx_t n); |
+ |
+/** |
+ * Constructs the suffix array of a given string, including the empty string. |
+ * @param T[0..n-1] The input string. |
+ * @param SA[0..n] The output array of suffixes (includes empty string). |
+ * @param n The length of the given string. |
+ * @return 0 if no error occurred, -1 or -2 otherwise. |
+ */ |
+saint_t divsufsort_include_empty(const sauchar_t *T, saidx_it SA, saidx_t n); |
+ |
+} // namespace divsuf |
+ |
+#endif // COURGETTE_BSDIFF_THIRD_PARTY_DIVSUFSORT_H_ |