-
-
Notifications
You must be signed in to change notification settings - Fork 89
Remove dependency to zlib, use free implementation of crc32() #695
Copy link
Copy link
Closed
Labels
dependenciesPull requests that update a dependency filePull requests that update a dependency file
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
dependenciesPull requests that update a dependency filePull requests that update a dependency file