// l-motif-court.c

// << Algorithmique du texte >>
// Maxime Crochemore, Christophe Hancart et Thierry Lecroq
// Vuibert, 2001.

#include <stdio.h>
#include "chl.h"


void lMotifCourt(Mot x, Longueur m, Mot y, Longueur n) {
   unsigned int i, j, R, S[CARDA], masq;
   Lettre a;

   for (a = PREMIERELETTRE; a <= DERNIERELETTRE; ++a)
      S[a] = ~0;
   for (i = 0, masq = 1; i <= m - 1; ++i, masq <<= 1)
      S[x[i]] &= ~masq;
   masq >>= 1;
   R = ~0;
   for (j = 0; j <= n - 1; ++j) {
      R = (R << 1) | S[y[j]];
      signalerSi((R & masq) == 0);
   }
}