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: Gaius Mulley
Subject: Re: [Gm2] can only CAST objects of the same size
Date: Wed, 29 Apr 2009 10:46:26 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Vladimir Karpenko <address@hidden> writes:

> 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.

Hi Vladimir,

any chance you can also post the variable definitions for PatternHash,
TextHash, Index, PatternLength and Prime.  You could try using ORDL
rather than ORD above - which performs the same operation as ORD but
it returns a LONGCARD result.

regards,
Gaius




reply via email to

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