I am trying to count something with gm2 here. Code looks something like that: PatternHash:=(PatternHash*Base+LONGCARD(ORD(FetchChar(Pattern, Index)))) MOD Prime; and like that:
TextHash:=(TextHash*Base+LONGCARD(ORD(FetchChar(Text, Index)))) MOD Prime; and like that: TextHash:=(TextHash+Base*Prime-LONGCARD(ORD(FetchChar(Text,Index)))*Power) MOD Prime; and like that
TextHash:=(TextHash*Base+LONGCARD(ORD(FetchChar(Text, Index+PatternLength)))) MOD Prime;
on every of the lines mentioned above i got some strange error: "can only CAST objects of the same size"
FetchChar looks like that: PROCEDURE FetchChar(Source:String; Index: CARDINAL):CHAR; BEGIN IF Index>Length(Source) THEN RETURN "|"; ELSE RETURN Source[Index];
END; END FetchChar; And string: TYPE String= ARRAY [0..255] OF CHAR; What should i do? Where am i wrong?