diff options
author | Noel Gordon <noel@chromium.org> | 2017-12-20 07:42:57 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2017-12-20 07:42:57 +0000 |
commit | e1769aea540cb51af978270aecfa06c731e04445 (patch) | |
tree | 18f836b46041d56395bb22e978b5b3174d3fc279 /adler32_simd.c | |
parent | 9eb2a75100c6df974568b78250edf42cf6ec84bf (diff) | |
download | zlib-e1769aea540cb51af978270aecfa06c731e04445.tar.gz |
zlib adler_simd.c: unsigned cast |blocks| on assignment
MSVC noted the unsigned |n| = size_t |blocks| could be a possible
loss in precision. No loss in precision occurs since (n > blocks)
at this point: |blocks| fits in an unsigned type.
To silence compiler warnings, first update BUILD.gn for the adler
SIMD code to use chromium compiler:chromium_code rule (more error
checking), rather than the permissive "compiler:no_chromium_code"
rule. Then cast |blocks| to unsigned on assigment to |n| (this is
safe to do as mentioned above).
No change in behavior, no new tests.
Tbr: cblume@chromium.org
Bug: 762564
Change-Id: Ia97120bcca206287fd42b97674f8a6215283e4a5
Reviewed-on: https://chromium-review.googlesource.com/835927
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#525285}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0cb9a22e2fb55e092342192d66f7e33c14432d27
Diffstat (limited to 'adler32_simd.c')
-rw-r--r-- | adler32_simd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/adler32_simd.c b/adler32_simd.c index d73f97e..1354915 100644 --- a/adler32_simd.c +++ b/adler32_simd.c @@ -76,7 +76,7 @@ uint32_t ZLIB_INTERNAL adler32_simd_( /* SSSE3 */ { unsigned n = NMAX / BLOCK_SIZE; /* The NMAX constraint. */ if (n > blocks) - n = blocks; + n = (unsigned) blocks; blocks -= n; const __m128i tap1 = @@ -237,7 +237,7 @@ uint32_t ZLIB_INTERNAL adler32_simd_( /* NEON */ { unsigned n = NMAX / BLOCK_SIZE; /* The NMAX constraint. */ if (n > blocks) - n = blocks; + n = (unsigned) blocks; blocks -= n; /* |