Functions

ID #1047

What are parameters of function CRC32?

CRC32(*CSTRING, UNSIGNED, ULONG), ULONG, RAW, NAME('Cla$CRC32')

Parameters

  • First - checked data block

 

  • Second - length of data block, passed by address as first parameter. I.e. roughly speaking, first parameter is not CSTRING. Attribute RAW defines that only address of string must be passed without length as usually. By the way this prototype may be written in this form:

CRC32(*STRING, ULONG), ULONG, NAME('Cla$CRC32')

In this example compiler will pass length of data block without assistance.

  • Third - initial value of control sum. It was done in ordre to calculate control sum for big data blocks passed to CRC32 sequentially by small blocks.

 

Example

Calc_CRC    PROCEDURE(*STRING BigData, ULONG DataLen)
CRC_Code    ULONG
TmpBuff     STRING(512)
  CODE
CRC_Code = 0
WHILE DataLen
IF DataLen > 512 THEN Len# = 512 ELSE Len# = DataLen.
TmpBuff = BigData[1:Len#]
CRC_Code = CRC32(TmpBuff,Len#,CRC_Code)
DataLen -= Len#
END
RETURN(CRC_Code)

Basically it was done for comfortable calculation of CRC-sum of file when it is impossible or inexpediently to read it to buffer entirely.

 

Tags: CRC32

Related entries:

Last update: 2007-07-15 19:48
Author: Oleg Rudenko
Revision: 1.0

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 4.5 out of 5 (2 Votes )

completely useless 1 2 3 4 5 most valuable

You can comment on this entry