gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] can only CAST objects of the same size


From: Vladimir Karpenko
Subject: [Gm2] can only CAST objects of the same size
Date: Sun, 26 Apr 2009 18:19:39 +0400
User-agent: KMail/1.10.3 (Linux/2.6.27.7-9-pae; KDE/4.1.3; i686; ; )

Hello, EveryBody,

        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?

Thanks, Vladimir.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]