Loading

Paste #pwtwowa1p

  1. static inline int find(const char *pat_data, int pat_size, const char *data, int data_size)
  2. {
  3.     int i;
  4.     for (i = 0; i + pat_size <= data_size; ++i) {
  5. #if 0
  6.         int j = 0;
  7.         while (j < pat_size && pat_data[j] == data[i + j]) ++j;
  8.         if (j == pat_size) return i;
  9. #else
  10.         if (__builtin_bcmp(pat_data, data + i, pat_size) == 0) return i;
  11. #endif
  12.     }
  13.     return -1;
  14. }

Comments