gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] can only CAST objects of the same size


From: Andreas Fischlin
Subject: Re: [Gm2] can only CAST objects of the same size
Date: Mon, 27 Apr 2009 08:19:30 +0200
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)

Dear Vladimir,

This is by definition the case with CAST and should always be. Use other routines in other cases.

Regards,
Andreas
 


Vladimir Karpenko wrote:
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.

_______________________________________________ gm2 mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/gm2
--
________________________________________________________________________
ETH Zurich
Prof. Dr. Andreas Fischlin
Systems Ecology - Institute of Integrative Biology
CHN E 21.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND

address@hidden
www.sysecol.ethz.ch

+41 44 633-6090 phone
+41 44 633-1136 fax

             Make it as simple as possible, but distrust it!
________________________________________________________________________
 

Attachment: andreas_fischlin.vcf
Description: Vcard


reply via email to

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