]> granicus.if.org Git - libvpx/commitdiff
test/lpf_test: fix int sanitizer warning
authorHien Ho <hienho@google.com>
Fri, 9 Aug 2019 23:33:57 +0000 (16:33 -0700)
committerHien Ho <hienho@google.com>
Tue, 13 Aug 2019 16:50:47 +0000 (16:50 +0000)
runtime error: implicit conversion from type 'int' of value 65594 (32-bit, signed)
to type 'uint16_t' (aka 'unsigned short') changed the value to 58 (16-bit, unsigned)

BUG=webm:1615

Change-Id: I6046a4a4fc0a108c337153f2c59d5cef5c8dcbd6

test/lpf_test.cc

index dfdd5159920bdc5fb72c9c14154d2b4d37f90ffa..9db1181c6c610ccfa24fad4d219783c0b74bd958 100644 (file)
@@ -75,9 +75,9 @@ void InitInput(Pixel *s, Pixel *ref_s, ACMRandom *rnd, const uint8_t limit,
         if (j < 1) {
           tmp_s[j] = rnd->Rand16();
         } else if (val & 0x20) {  // Increment by a value within the limit.
-          tmp_s[j] = tmp_s[j - 1] + (limit - 1);
+          tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] + (limit - 1));
         } else {  // Decrement by a value within the limit.
-          tmp_s[j] = tmp_s[j - 1] - (limit - 1);
+          tmp_s[j] = static_cast<uint16_t>(tmp_s[j - 1] - (limit - 1));
         }
         j++;
       }
@@ -94,11 +94,11 @@ void InitInput(Pixel *s, Pixel *ref_s, ACMRandom *rnd, const uint8_t limit,
         if (j < 1) {
           tmp_s[j] = rnd->Rand16();
         } else if (val & 0x20) {  // Increment by a value within the limit.
-          tmp_s[(j % 32) * 32 + j / 32] =
-              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] + (limit - 1);
+          tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
+              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] + (limit - 1));
         } else {  // Decrement by a value within the limit.
-          tmp_s[(j % 32) * 32 + j / 32] =
-              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] - (limit - 1);
+          tmp_s[(j % 32) * 32 + j / 32] = static_cast<uint16_t>(
+              tmp_s[((j - 1) % 32) * 32 + (j - 1) / 32] - (limit - 1));
         }
         j++;
       }