32 keyword(
const unsigned char * p,
const char * s,
size_t len)
34 if (len == 0 || len > p[0] || p[len] == 1)
36 p = p + p[0] + p[len] + 3;
38 const unsigned char * q = p + n * (p[-2] + 1);
42 const unsigned char * m = p + (q - p) / d * n;
43 int cmp = memcmp(s, m, len);
56 keyword2(
const unsigned char * p,
const char * s,
size_t len)
58 if (len == 0 || len > p[0])
60 unsigned offset = (p[len * 2 - 1] | p[len * 2] << 8);
63 p = p + 2 * p[0] + offset + 3;
65 const unsigned char * q = p + n * (p[-2] + 1);
69 const unsigned char * m = p + (q - p) / d * n;
70 int cmp = memcmp(s, m, len);
int keyword2(const unsigned char *p, const char *s, size_t len)
2 byte offset variant.
int keyword(const unsigned char *p, const char *s, size_t len)
Efficient keyword to enum lookup.