Differences From Artifact [1f7220abde]:
- File
src/crc32.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 892) [annotate] [blame] [check-ins using]
To Artifact [888c0b6538]:
- File src/crc32.m — part of check-in [4594f434e7] at 2017-08-06 19:40:19 on branch trunk — OFZIPArchive: Add write and append support (user: js, size: 898) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
17 18 19 20 21 22 23 | #include "config.h" #import "crc32.h" #define CRC32_MAGIC 0xEDB88320 uint32_t | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "config.h" #import "crc32.h" #define CRC32_MAGIC 0xEDB88320 uint32_t of_crc32(uint32_t crc, const unsigned char *bytes, size_t length) { for (size_t i = 0; i < length; i++) { crc ^= bytes[i]; for (uint8_t j = 0; j < 8; j++) crc = (crc >> 1) ^ (CRC32_MAGIC & (~(crc & 1) + 1)); } return crc; } |