共用方式為


_mm_crc32_u16

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction crc32. This instruction adds one parameter to the CRC-32C checksum of the other parameter.

unsigned int _mm_crc32_u16 (
   unsigned int crc,
   unsigned short v
); 

Parameters

Parameter

Description

[in] crc

An unsigned integer to add.

[in] v

An unsigned short value. The checksum will be computed from this input parameter.

Return value

r := crc + CRC-32C(v)

Requirements

Intrinsic

Architecture

_mm_crc32_u16

x86, x64

Header file <nmmintrin.h>

Remarks

CRC32-C algorithm is based on polynomial 0x1EDC6F41. It is implemented by following little-endian convention. This means that the most significant bit is treated as the least significant bit in the quotient.

Before using this intrinsic, software must ensure that the processor supports this instruction.

Example

#include <stdio.h>
#include <nmmintrin.h>

int main ()
{
    unsigned int crc = 1;
    unsigned short input = 1000;

    unsigned int res = _mm_crc32_u16(crc, input);
    printf_s("Result res: %u\n", res);

    return 0;
}

Result res: 3870914500

See Also

Concepts

_mm_crc32_u8

_mm_crc32_u32

_mm_crc32_u64

__m64