7 namespace libdivsufsort {
10 using saidx_t = ssize_t;
15 const bool divsufsort64 = (
sizeof(saidx_t) > 4);
18 const saint_t lg_table[256]= {
19 -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
20 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
21 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
22 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
23 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
24 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
25 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
26 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
31 template<
typename T,
typename X =
void>
32 struct ilg_dispatch_t {};
35 struct ilg_dispatch_t<T, typename
std::enable_if<sizeof(T) * CHAR_BIT == 32>::type> {
36 inline static saint_t calc(T x) {
38 return (n & 0xffff0000) ?
40 24 + lg_table[(n >> 24) & 0xff] :
41 16 + lg_table[(n >> 16) & 0xff]) :
43 8 + lg_table[(n >> 8) & 0xff] :
44 0 + lg_table[(n >> 0) & 0xff]);
49 struct ilg_dispatch_t<T, typename
std::enable_if<sizeof(T) * CHAR_BIT == 64>::type> {
50 inline static saint_t calc(T x) {
55 56 + lg_table[(n >> 56) & 0xff] :
56 48 + lg_table[(n >> 48) & 0xff]) :
58 40 + lg_table[(n >> 40) & 0xff] :
59 32 + lg_table[(n >> 32) & 0xff])) :
62 24 + lg_table[(n >> 24) & 0xff] :
63 16 + lg_table[(n >> 16) & 0xff]) :
65 8 + lg_table[(n >> 8) & 0xff] :
66 0 + lg_table[(n >> 0) & 0xff]));
70 template<
typename idx_t>
71 inline saint_t ilg(idx_t n) {
72 return ilg_dispatch_t<idx_t>::calc(n);
77 inline saint_t ilg(saidx_t n) {
78 #if SS_BLOCKSIZE < 256 82 8 + lg_table[(n >> 8) & 0xff] :
83 0 + lg_table[(n >> 0) & 0xff];
Contains the text compression and encoding framework.
uint8_t uliteral_t
Type to represent signed single literals.