Commit 48d85cee07 for aom
commit 48d85cee071eb0599c536d840a78fef426d0d49f
Author: James Zern <jzern@google.com>
Date: Thu Jun 18 15:01:07 2026 -0700
{cdef,reconinter}_test.cc: fix bitwise shift warning
Fixes some clang-19 static analysis warnings of the form:
```
The result of left shift is undefined because the right operand is
negative
```
Bug: 474642915
Change-Id: Iece63e7f972d506c0afee09ab5ff1e3758850f64
diff --git a/test/cdef_test.cc b/test/cdef_test.cc
index 6f985f03f4..df535abcdd 100644
--- a/test/cdef_test.cc
+++ b/test/cdef_test.cc
@@ -10,6 +10,7 @@
*/
#include <array>
+#include <cassert>
#include <cstdlib>
#include <iostream>
#include <string>
@@ -89,6 +90,7 @@ int64_t test_cdef(BLOCK_SIZE bsize, int iterations,
((bsize == BLOCK_8X8) || (bsize == BLOCK_8X4)) ? 8 : 4;
const int block_height =
((bsize == BLOCK_8X8) || (bsize == BLOCK_4X8)) ? 8 : 4;
+ assert(depth >= 8); // Suppress static analysis warning w/negative depth - 8.
const unsigned int max_pos = size * size >> static_cast<int>(depth == 8);
for (pridamping = 3 + depth - 8; pridamping < 7 - 3 * !!boundary + depth - 8;
pridamping++) {
diff --git a/test/reconinter_test.cc b/test/reconinter_test.cc
index 91bf7200ae..2bfa074652 100644
--- a/test/reconinter_test.cc
+++ b/test/reconinter_test.cc
@@ -267,6 +267,8 @@ class BuildCompDiffwtdMaskD16Test
const int in_precision =
bd + 2 * FILTER_BITS - conv_params.round_0 - conv_params.round_1 + 2;
+ ASSERT_GT(in_precision, 0);
+ ASSERT_LE(in_precision, 18);
for (int i = 0; i < MAX_SB_SQUARE; i++) {
src0[i] = rnd_.Rand16() & ((1 << in_precision) - 1);
@@ -308,6 +310,8 @@ class BuildCompDiffwtdMaskD16Test
const int in_precision =
bd + 2 * FILTER_BITS - conv_params.round_0 - conv_params.round_1 + 2;
+ ASSERT_GT(in_precision, 0);
+ ASSERT_LE(in_precision, 18);
for (int i = 0; i < MAX_SB_SQUARE; i++) {
src0[i] = rnd_.Rand16() & ((1 << in_precision) - 1);