========================================================================= */
(crc, buf, len)
| 217 | |
| 218 | /* ========================================================================= */ |
| 219 | unsigned long ZEXPORT crc32(crc, buf, len) |
| 220 | unsigned long crc; |
| 221 | const unsigned char FAR *buf; |
| 222 | unsigned len; |
| 223 | { |
| 224 | if (buf == Z_NULL) return 0UL; |
| 225 | |
| 226 | #ifdef DYNAMIC_CRC_TABLE |
| 227 | if (crc_table_empty) |
| 228 | make_crc_table(); |
| 229 | #endif /* DYNAMIC_CRC_TABLE */ |
| 230 | |
| 231 | #ifdef BYFOUR |
| 232 | if (sizeof(void *) == sizeof(ptrdiff_t)) { |
| 233 | u4 endian; |
| 234 | |
| 235 | endian = 1; |
| 236 | if (*((unsigned char *)(&endian))) |
| 237 | return crc32_little(crc, buf, len); |
| 238 | else |
| 239 | return crc32_big(crc, buf, len); |
| 240 | } |
| 241 | #endif /* BYFOUR */ |
| 242 | crc = crc ^ 0xffffffffUL; |
| 243 | while (len >= 8) { |
| 244 | DO8; |
| 245 | len -= 8; |
| 246 | } |
| 247 | if (len) do { |
| 248 | DO1; |
| 249 | } while (--len); |
| 250 | return crc ^ 0xffffffffUL; |
| 251 | } |
| 252 | |
| 253 | #ifdef BYFOUR |
| 254 |
no test coverage detected