60 template <
typename FMIndex,
typename String,
typename Stack,
typename Delegate>
71 if (mismatches == 0 || seed == len)
73 const uint2 range =
match( fmi, pattern, len );
75 if (range.x <= range.y)
80 uint2 root_range =
match(
81 fmi, pattern + len - seed, seed );
84 if (root_range.x > root_range.y)
89 rank4( fmi, make_uint2( root_range.x-1, root_range.y ), &cnt_k, &cnt_l );
94 const uint8 c_pattern = pattern[ len - seed - 1u ];
96 for (
uint32 c = 0; c < 4; ++c)
99 if (
comp( cnt_k, c ) <
comp( cnt_l, c ))
101 const uint8 cost = (c == c_pattern) ? 0u : 1u;
103 const uint2 range_c = make_uint2(
104 fmi.L2(c) +
comp( cnt_k, c ) + 1,
105 fmi.L2(c) +
comp( cnt_l, c ) );
107 stack[sp] = make_uint4( range_c.x, range_c.y, cost, len - seed - 1u );
118 const uint4 entry_info = stack[sp];
119 const uint8 cost = entry_info.z;
120 const uint32 l = entry_info.w;
121 uint2 range = make_uint2( entry_info.x, entry_info.y );
126 if (range.x <= range.y)
130 if (cost < mismatches)
134 rank4( fmi, make_uint2( range.x-1, range.y ), &cnt_k, &cnt_l );
136 const uint8 c_pattern = pattern[l-1u];
138 for (
uint32 c = 0; c < 4; ++c)
141 if (
comp( cnt_k, c ) <
comp( cnt_l, c ))
143 const uint2 range_c = make_uint2(
144 fmi.L2(c) +
comp( cnt_k, c ) + 1,
145 fmi.L2(c) +
comp( cnt_l, c ) );
148 const uint8 new_cost = cost + (c == c_pattern ? 0u : 1u);
151 stack[sp] = make_uint4( range_c.x, range_c.y, new_cost, l-1u );
160 range =
match( fmi, pattern, l, range );
163 if (range.x <= range.y)