Commit 0cb9a22e authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

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: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525285}
parent bb08a271
......@@ -51,9 +51,6 @@ source_set("zlib_adler32_simd") {
}
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":zlib_adler32_simd_config" ]
}
......
......@@ -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;
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment