44 template <u
int32 ALPHABET_SIZE>
50 #pragma unroll ALPHABET_SIZE
64 #pragma unroll ALPHABET_SIZE
81 for (
uint32 c = 0; c < 2; c++)
88 const uint8 cc = c & 1u;
89 if (cc == 0)
B[0] |= v;
90 if (cc == 1)
B[1] |= v;
96 const uint8 cc = c & 1u;
97 return cc == 0 ?
B[0] :
B[1];
104 for(
uint32 c = 0; c < 2; c++)
120 for (
uint32 c = 0; c < 4; c++)
127 const uint8 cc = c & 3u;
128 if (cc == 0)
B[0] |= v;
129 if (cc == 1)
B[1] |= v;
130 if (cc == 2)
B[2] |= v;
131 if (cc == 3)
B[3] |= v;
137 const uint8 cc = c & 3u;
139 cc == 0 ?
B[0] :
B[1] :
140 cc == 2 ?
B[2] :
B[3];
147 for(
uint32 c = 0; c < 4; c++)
163 for (
uint32 c = 0; c < 4; c++)
170 if (c == 0)
B[0] |= v;
171 if (c == 1)
B[1] |= v;
172 if (c == 2)
B[2] |= v;
173 if (c == 3)
B[3] |= v;
174 if (c == 4)
B[4] |= v;
180 return c <= 1 ? (c == 0 ?
B[0] :
B[1]) :
181 c <= 3 ? (c == 2 ?
B[2] :
B[3]) :
189 for(
uint32 c = 0; c < 5; c++)
196 template <u
int32 BAND_WIDTH>
201 const uint32 D0 = ((VP + (X & VP)) ^ VP) | X;
202 const uint32 HN = VP & D0;
203 const uint32 HP = VN | ~ (VP | D0);
206 VP = HN | ~ (X | HP);
208 return 1 - ((D0 >> (BAND_WIDTH - 1)) & 1u);
211 template <u
int32 BAND_WIDTH>
216 const uint32 D0 = ((VP + (X & VP)) ^ VP) | X;
217 const uint32 HN = VP & D0;
218 const uint32 HP = VN | ~ (VP | D0);
221 VP = HN | ~ (X | HP);
223 return ((HP >> s) & 1) - ((HN >> s) & 1);
231 typename pattern_string,
232 typename text_string,
236 const pattern_string pattern,
237 const text_string
text,
238 const int16 min_score,
241 const uint32 pattern_len = pattern.length();
242 const uint32 text_len = text.length();
245 if (text_len < pattern_len)
253 int dist = -int( C );
257 for (
int j = 0; j < C; j++)
258 B.
load( pattern[j], 1u << (BAND_WIDTH - C + j) );
262 for(
uint32 i = 0; i < last; ++i)
266 B.
load( pattern[ C + i ], 1u << (BAND_WIDTH - 1) );
268 dist -= diagonal_column<BAND_WIDTH>( B.
get( text[i] ), VP, VN );
272 int s = BAND_WIDTH - 1u + pattern_len - C - last;
273 for (
uint32 i = last; i < text_len && s >= 0; ++i)
277 dist -= horizontal_column<BAND_WIDTH>( B.
get( text[i] ), VP, VN, s );
281 sink.report( dist, make_uint2( i+1, pattern_len ) );
286 sink.report( dist, make_uint2( text_len, pattern_len ) );
306 typename pattern_type,
313 pattern_type pattern,
316 const int32 min_score,
319 return banded_myers<BAND_LEN,0u,TYPE,ALPHABET_SIZE>(
343 typename pattern_type,
347 typename checkpoint_type>
351 pattern_type pattern,
354 const int32 min_score,
355 const uint32 window_begin,
358 checkpoint_type checkpoint)
360 return banded_myers<BAND_LEN,0u,TYPE,ALPHABET_SIZE>(