[fpc-devel]Range check error?!

Jonas Maebe jonas at zeus.rug.ac.be
Mon Jan 29 13:24:44 CET 2001


On Sat, 27 Jan 2001, C.Keck wrote:

> function build_edc (var inout : array of byte; from, upto : integer) : longint;
> 
> var i : integer;
> 
> begin
>   build_edc:= 0;
>   for i:= from to upto-1 do
>     build_edc:= EDC_crctable[(build_edc xor inout[i]) and $FF] xor (build_edc shr 8);
> end;
> 
> FYI: EDC_crctable[] is an array with longint values

Are you sure it isn't an array of cardinal? Because in that case, itf the
result is > $7fffffff, then it's bigger than maxlongint and you'll get a
range error when assigning the result to build_edc.


Jonas





More information about the fpc-devel mailing list