PtCRCValue()

Calculate a running CRC checksum

Synopsis:

long PtCRCValue( long crc32val,
                 unsigned char next_val );

Library:

ph

Description:

This function lets you maintain your own 32-bit cyclic redundancy check or CRC checksum. The crc32val is 0 or the value calculated by a previous call to PtCRCValue(), while next_val is the next byte of data for which to calculate the CRC.


Note: We recommend that bitmaps and images have a CRC on the image data and the palette. This CRC is used extensively by phrelay (see the QNX Neutrino Utilities Reference) to cache images.

You can call PtCRC() to calculate a CRC for a block of data.

Returns:

The cyclic redundancy check.

Examples:

This is a slower implementation of PtCRC() for a 512-byte data segment:

unsigned char data[512];
unsigned char *ptr;
long crcval = 0;
int i;

for (ptr = data, i = 0; i < sizeof( data ); 
     i++, ptr++) {
  crcval = PtCRCValue( crcval, *ptr );
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtCRC(), PxLoadImage()

Images in the Raw Drawing and Animation chapter of the Photon Programmer's Guide