Calculate a running CRC checksum
long PtCRCValue( long crc32val, unsigned char next_val );
ph
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.
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.
The cyclic redundancy check.
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 ); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
“Images” in the Raw Drawing and Animation chapter of the Photon Programmer's Guide