libc: add reference to two-way algorithm and bad shift table in memmem/strstr
Requested by: ed
This commit is contained in:
parent
88521634e9
commit
01dc206b22
@ -58,6 +58,14 @@ static char *fourbyte_memmem(const unsigned char *h, size_t k, const unsigned ch
|
||||
#define BITOP(a,b,op) \
|
||||
((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
|
||||
|
||||
/*
|
||||
* Two Way string search algorithm, with a bad shift table applied to the last
|
||||
* byte of the window. A bit array marks which entries in the shift table are
|
||||
* initialized to avoid fully initializing a 1kb/2kb table.
|
||||
*
|
||||
* Reference: CROCHEMORE M., PERRIN D., 1991, Two-way string-matching,
|
||||
* Journal of the ACM 38(3):651-675
|
||||
*/
|
||||
static char *twoway_memmem(const unsigned char *h, const unsigned char *z, const unsigned char *n, size_t l)
|
||||
{
|
||||
size_t i, ip, jp, k, p, ms, p0, mem, mem0;
|
||||
|
@ -55,6 +55,14 @@ static char *fourbyte_strstr(const unsigned char *h, const unsigned char *n)
|
||||
#define BITOP(a,b,op) \
|
||||
((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
|
||||
|
||||
/*
|
||||
* Two Way string search algorithm, with a bad shift table applied to the last
|
||||
* byte of the window. A bit array marks which entries in the shift table are
|
||||
* initialized to avoid fully initializing a 1kb/2kb table.
|
||||
*
|
||||
* Reference: CROCHEMORE M., PERRIN D., 1991, Two-way string-matching,
|
||||
* Journal of the ACM 38(3):651-675
|
||||
*/
|
||||
static char *twoway_strstr(const unsigned char *h, const unsigned char *n)
|
||||
{
|
||||
const unsigned char *z;
|
||||
|
Loading…
x
Reference in New Issue
Block a user