sdlCrc16 function

int sdlCrc16(
  1. int crc,
  2. Pointer<NativeType> data,
  3. int len
)

Calculate a CRC-16 value.

https://en.wikipedia.org/wiki/Cyclic_redundancy_check

This function can be called multiple times, to stream data to be checksummed in blocks. Each call must provide the previous CRC-16 return value to be updated with the next block. The first call to this function for a set of blocks should pass in a zero CRC value.

\param crc the current checksum for this data set, or 0 for a new data set. \param data a new block of data to add to the checksum. \param len the size, in bytes, of the new block of data. \returns a CRC-16 checksum value of all blocks in the data set.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t len)

Implementation

int sdlCrc16(int crc, Pointer<NativeType> data, int len) {
  final sdlCrc16LookupFunction = libSdl3.lookupFunction<
      Uint16 Function(Uint16 crc, Pointer<NativeType> data, Uint32 len),
      int Function(int crc, Pointer<NativeType> data, int len)>('SDL_crc16');
  return sdlCrc16LookupFunction(crc, data, len);
}