OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. |
| 2 // |
| 3 // For the terms under which this work may be distributed, please see |
| 4 // the adjoining file "LICENSE". |
| 5 // |
| 6 // ChangeLog: |
| 7 // 2016-07-22 - Initial commit and adaption to use PagedArray. |
| 8 // --Samuel Huang <huangs@chromium.org> |
| 9 |
| 10 #ifndef COURGETTE_BSDIFF_THIRD_PARTY_DIVSUFSORT_H_ |
| 11 #define COURGETTE_BSDIFF_THIRD_PARTY_DIVSUFSORT_H_ |
| 12 |
| 13 #include <stdint.h> |
| 14 |
| 15 #include "courgette/third_party/bsdiff/paged_array.h" |
| 16 |
| 17 namespace divsuf { |
| 18 |
| 19 /*- Datatypes -*/ |
| 20 typedef int32_t saint_t; |
| 21 typedef int32_t saidx_t; |
| 22 typedef uint8_t sauchar_t; |
| 23 |
| 24 #ifdef DIVSUFSORT_NO_PAGED_ARRAY |
| 25 typedef saidx_t* saidx_it; |
| 26 typedef const saidx_t* const_saidx_it; |
| 27 #else |
| 28 typedef courgette::PagedArray<saidx_t>::iterator saidx_it; |
| 29 typedef courgette::PagedArray<saidx_t>::const_iterator const_saidx_it; |
| 30 #endif |
| 31 |
| 32 /*- Prototypes -*/ |
| 33 |
| 34 /** |
| 35 * Constructs the suffix array of a given string, excluding the empty string. |
| 36 * @param T[0..n-1] The input string. |
| 37 * @param SA[0..n-1] The output array of suffixes. |
| 38 * @param n The length of the given string. |
| 39 * @return 0 if no error occurred, -1 or -2 otherwise. |
| 40 */ |
| 41 saint_t divsufsort(const sauchar_t *T, saidx_it SA, saidx_t n); |
| 42 |
| 43 /** |
| 44 * Constructs the suffix array of a given string, including the empty string. |
| 45 * @param T[0..n-1] The input string. |
| 46 * @param SA[0..n] The output array of suffixes (includes empty string). |
| 47 * @param n The length of the given string. |
| 48 * @return 0 if no error occurred, -1 or -2 otherwise. |
| 49 */ |
| 50 saint_t divsufsort_include_empty(const sauchar_t *T, saidx_it SA, saidx_t n); |
| 51 |
| 52 } // namespace divsuf |
| 53 |
| 54 #endif // COURGETTE_BSDIFF_THIRD_PARTY_DIVSUFSORT_H_ |
OLD | NEW |