- static inline int find(const char *pat_data, int pat_size, const char *data, int data_size)
- {
- int i;
- for (i = 0; i + pat_size <= data_size; ++i) {
- #if 0
- int j = 0;
- while (j < pat_size && pat_data[j] == data[i + j]) ++j;
- if (j == pat_size) return i;
- #else
- if (__builtin_bcmp(pat_data, data + i, pat_size) == 0) return i;
- #endif
- }
- return -1;
- }