Skip to content

Remove dependency to zlib, use free implementation of crc32() #695

@uweseimet

Description

@uweseimet

The zlib dependency is only required for the crc32() call in ctapdriver.cpp. A free crc32 implementation can be used instead:

// See https://stackoverflow.com/questions/21001659/crc32-algorithm-implementation-in-c-without-a-look-up-table-and-with-a-public-li
uint32_t crc32(BYTE *buf, int length) {
   uint32_t crc = 0xffffffff;
   for (int i = 0; i < length; i++) {
      crc ^= buf[i];
      for (int j = 0; j < 8; j++) {
         uint32_t mask = -(crc & 1);
         crc = (crc >> 1) ^ (0xEDB88320 & mask);
      }
   }
   return ~crc;
}

This implementation returns the same results as the zlib one. It may be a bit slower, but for rascsi/Daynaport this is not relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency file

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions