summaryrefslogtreecommitdiffstats
path: root/lib/crc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/crc32.c')
-rw-r--r--lib/crc32.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/crc32.c b/lib/crc32.c
index eaaa06a0c..be98f1a8d 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -108,8 +108,10 @@ uint32_t crc32(uint32_t seed, const unsigned char *buf, size_t len)
uint32_t crc = seed;
const unsigned char *p = buf;
- while(len-- > 0)
+ while (len) {
crc = crc32_tab[(crc ^ *p++) & 0xff] ^ (crc >> 8);
+ len--;
+ }
return crc;
}