summaryrefslogtreecommitdiff
path: root/crc32.c
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2019-01-16 11:49:29 +0100
committerHans Kristian Rosbach <hk-github@circlestorm.org>2019-01-21 10:25:50 +0100
commit18d26229390a7e92627ee8350b3a2687e878fd03 (patch)
tree587fc7d7ea5769229709077efa878f8bd67ec12b /crc32.c
parenta3045b4170be007591008ea6b77e8ea621093cfe (diff)
Replace the UNROLL_LESS define with UNROLL_MORE, making UNROLL_LESS the default.
Performance benchmarks have so far not shown that any platform benefits from UNROLL_MORE, although this might be beneficial on older compilers/cpus or for compiling without optimizations. The extra UNROLL_MORE code should be considered for removal since it is never enabled by us and will likely only serve to confuse and contribute to bitrot.
Diffstat (limited to 'crc32.c')
-rw-r--r--crc32.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/crc32.c b/crc32.c
index 95080b3..33e82d3 100644
--- a/crc32.c
+++ b/crc32.c
@@ -255,16 +255,16 @@ ZLIB_INTERNAL uint32_t crc32_generic(uint32_t crc, const unsigned char *buf, uin
{
crc = crc ^ 0xffffffff;
-#ifdef UNROLL_LESS
- while (len >= 4) {
- DO4;
- len -= 4;
- }
-#else
+#ifdef UNROLL_MORE
while (len >= 8) {
DO8;
len -= 8;
}
+#else
+ while (len >= 4) {
+ DO4;
+ len -= 4;
+ }
#endif
if (len) do {
@@ -310,7 +310,7 @@ ZLIB_INTERNAL uint32_t crc32_little(uint32_t crc, const unsigned char *buf, uint
buf4 = (const uint32_t *)(const void *)buf;
-#ifndef UNROLL_LESS
+#ifdef UNROLL_MORE
while (len >= 32) {
DOLIT32;
len -= 32;
@@ -352,7 +352,7 @@ ZLIB_INTERNAL uint32_t crc32_big(uint32_t crc, const unsigned char *buf, uint64_
buf4 = (const uint32_t *)(const void *)buf;
-#ifndef UNROLL_LESS
+#ifdef UNROLL_MORE
while (len >= 32) {
DOBIG32;
len -= 32;