#include #include int bt_skip_func(const __uint32_t len_limit, const __uint8_t *cur, int delta, __uint32_t len) { const __uint8_t *pb = cur - delta; while (++len != len_limit) { if (pb[len] != cur[len]) break; if (++len == len_limit) break; if (pb[len] != cur[len]) break; if (++len == len_limit) break; if (pb[len] != cur[len]) break; if (++len == len_limit) break; if (pb[len] != cur[len]) break; } return len; } int main (int argc, char *argv[]) { char *text_input = "ttttttttttttttttthis is some text that should be longer"; int len_limit = strlen (text_input); int pos = 0; int cur_match = 0; int depth = 0; int result = bt_skip_func(len_limit, text_input + 3, 3, 1); }