Visible to Intel only — GUID: GUID-7469C940-46A8-4667-A468-5AA403710F61
Visible to Intel only — GUID: GUID-7469C940-46A8-4667-A468-5AA403710F61
CRC_8u
Computes checksum for a given data vector.
Syntax
IppStatus ippsCRC_8u(Ipp8u* pSrc, int len, Ipp64u poly, Ipp8u optPoly[128], Ipp32u init, Ipp32u* pCRC16);
Include Files
ippe.h
Domain Dependencies
ippcore.h
Libraries
ippe.lib
Parameters
pSrc |
The pointer to the source vector. |
len |
The length of the vector, number of items. |
poly |
CRC polynomial with explicit leading 1. Indicates CRC length: 8/16/24/32 bits. |
optPoly |
The initialized data table (NULL, by default). |
init |
The initial value of a register. |
pCRC |
Pointer to the CRC value. |
Description
This function computes the CRC value with the polynomial poly and the initial value init for the input vector pSrc with the length len bytes. The default optPoly value is NULL.
This function supports only 8, 16, 24, and 32 bytes-length polynomials. The bytes number of the CRC algorithm (8, 16, 24, or 32) is defined by the position of the most significant 1 bit in poly. The polynomial must be specified in full. For example, for CRC16 with the 0x1021 polynomial, the poly value must be 0x11021.
Low-level ippsCRC_8u optimization requires special tables for every poly value. This function calls the optimized code only for the fixed set of polynomials by default and returns ippStsNoErr status. If such table is not available for poly, it calculates CRC using non-optimized code and returns the ippStsNonOptimalPathSelected warning.
To compute CRC for an arbitrary polynomial with low-level optimization, you need to initialize the optPoly table first with the ippsGenCRCOptPoly_8u function and transfer optPoly into ippsCRC_8u.
Example
// Computing CRC16 for the 0x1021 polynomial int main() { Ipp8u* src = "123456789"; IppStatus status; Ipp32u CRC; Ipp64u poly = 0x11021;//Default polynomial Ipp32u init = 0xFFFF; status = ippsCRC_8u(src, 9, poly, NULL, init, &CRC); printf("status = '%s'\n", ippGetStatusString(status)); printf("CRC=0x%x\n", CRC); return 0; }
The result:
status = 'ippStsNoErr: No errors' CRC=0x29b1
Return Values
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error if the pointer to the source vector is NULL. |
ippStsSizeErr |
Indicates an error if the length of the source vector is less than or equal to 0. |
ippStsAlgTypeErr |
Indicates an error if the most significant 1 bit is in the wrong position. |
ippStsBadArgErr |
Indicates an error if the optPoly value does not match poly value. |
ippStsNonOptimalPathSelected |
Indicates an error if the function returns the positive warning. Call ippsGenCRCOptPoly_8u to compute the table. |