{$local R-, X+, W-} function ComputeChecksum (const Buf: array of Byte) = Sum: GPIInt; var i, iLoopCount: GPIInt; p: PCInteger; begin Sum := 0; iLoopCount := ( High( Buf) + 1) div SizeOf( CInteger); p := PCInteger( @Buf); for i:= 1 to iLoopCount do begin Sum := Sum + p^; p := p + 1 end end; {$endlocal}
Sorry, I found a faster version after my post
{$local R-, X+, W-} function ComputeChecksum (const Buf: array of Byte) = Sum: GPIInt; var iLoopCount: GPIInt; pb, pe, p: PCInteger; begin Sum := 0; iLoopCount := ( High( Buf) + 1) div SizeOf( CInteger); pb := PCInteger( @Buf); pe := pb + iLoopCount - 1; for p:= pb to pe do Sum := Sum + p^; end; {$endlocal}
Regards,
Adriaan van Os