11 const char *pachPattern,
15 ssize_t i, j, len_max = len_text - len_pattern;
17 ssize_t *bm_gc, *suffixes;
19 bm_gc = (ssize_t*) alloca(
sizeof(ssize_t) * (len_pattern + 1));
20 suffixes = (ssize_t*) alloca(
sizeof(ssize_t) * (len_pattern + 1));
22 memset( bm_gc, 0,
sizeof(ssize_t) * (len_pattern+1) );
23 memset( suffixes, 0,
sizeof(ssize_t) * (len_pattern+1) );
26 memset(bm_bc, -1,
sizeof(bm_bc));
27 for( i=0; i!=len_pattern; ++i )
36 char ch1 = pachPattern[len_pattern-i];
37 while ( j <= len_pattern && ch1 != pachPattern[len_pattern-j] )
50 for( i=0; i<=len_pattern; ++i )
63 while( j != 0 && pachPattern[len_pattern-j] == pachText[len_text - i - j] )
66 return len_text - len_pattern - i + 1;
68 char chText = pachText[len_text - i - j];
69 ssize_t shift_gc = bm_gc[j];
71 i += ( (shift_gc > shift_bc) ? shift_gc : shift_bc );
84 const char *pachPattern,
90 for( i=0; i<=start; ++i ) {
92 for( j=0; j!=len_pattern; ++j ) {
93 if( pachText[j]!=pachPattern[j] )
113 if( (size_src != 0) && (size_patt != 0) && (size_patt <= size_src) && (start != 0))
117 start = size_src - size_patt + 1;
118 else if( start > size_src )
120 else if( start > size_src - size_patt )
121 start = size_src - size_patt + 1;
128 patt->
data, size_patt );
132 patt->
data, size_patt );