[fpc-devel]Range check error?!

C.Keck C.Keck at gmx.net
Mon Jan 29 14:30:58 CET 2001


Original message from: Jonas Maebe
>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
>

Thanks for the help! Meanwhile I found the bug: The function was called with some wrong parameters by another
function... However, I was able to fix this now ;)

Chris






More information about the fpc-devel mailing list