From: Adam Stylinski Date: Sun, 27 Mar 2022 23:20:08 +0000 (-0400) Subject: Use size_t types for len arithmetic, matching signature X-Git-Tag: 2.1.0-beta1~292 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=e43e0b21893b55d6b44d3f8b7105fcb655e87f5a;p=thirdparty%2Fzlib-ng.git Use size_t types for len arithmetic, matching signature This suppresses a warning and keeps everything safely the same type. While it's unlikely that the input for any of this will exceed the size of an unsigned 32 bit integer, this approach is cleaner than casting and should not result in a performance degradation. --- diff --git a/arch/x86/adler32_ssse3.c b/arch/x86/adler32_ssse3.c index 5d28ac95..014c89a8 100644 --- a/arch/x86/adler32_ssse3.c +++ b/arch/x86/adler32_ssse3.c @@ -59,10 +59,10 @@ Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size * additions worthwhile or if it's worth it to just eat the cost of an unaligned * load. This is a pretty simple test, just test if 16 - the remainder + len is * < 16 */ - uint32_t max_iters = NMAX; - uint32_t rem = (uintptr_t)buf & 15; - uint32_t align_offset = 16 - rem; - uint32_t k = 0; + size_t max_iters = NMAX; + size_t rem = (uintptr_t)buf & 15; + size_t align_offset = 16 - rem; + size_t k = 0; if (rem) { if (len < 16 + align_offset) { /* Let's eat the cost of this one unaligned load so that @@ -79,7 +79,7 @@ Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size goto unaligned_jmp; } - for (uint32_t i = 0; i < align_offset; ++i) { + for (size_t i = 0; i < align_offset; ++i) { adler += *(buf++); sum2 += adler; }