summaryrefslogtreecommitdiff
path: root/rabincarp.h
blob: 753ff6620cae2b8774555d32978ebada8d6503c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef __RABINCARP_H
#define __RABINCARP_H

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

typedef struct rol_hash_isearch
{
  int b;
  int m;
  int pow;

  int   pattern_len;
  int   text_len;
  int   pattern_hash;
  int   text_hash;
  char *text;
  char *pattern;
  int   iter_pos;

  char *pre_text;
  int   count;
  int   chunk_done;
} rol_hash_isearch;

int rlsi_hash_reset(rol_hash_isearch *rlh);
int rlsi_hash_init(rol_hash_isearch *rlh, int b, int m);
int rlsi_hash_precalc(rol_hash_isearch *rlh, char *pattern, int plen, char *text, int tlen);
int rlsi_hash_search(rol_hash_isearch *rlh, char *pattern, int plen, char *text, int tlen);
int rlsi_hash_get(rol_hash_isearch *rlh);

#endif