Tiny cleanup in cdef_test.cc
This was triggered by a visual studio compile warning:
cdef_test.cc(128):
warning C4804: '>>': unsafe use of type 'bool' in operation
However the code is rather hard to parse for humans too: when I first
looked, I thought this was something to do with C++ templating...
The new version is equivalent but defines max_pos in an outer
loop (and a smaller indent).
Change-Id: I0c5cabeee44d0839a7956a4ab1cf4ec5abfcc9ee
diff --git a/test/cdef_test.cc b/test/cdef_test.cc
index d2ab692..b6250b6 100644
--- a/test/cdef_test.cc
+++ b/test/cdef_test.cc
@@ -68,6 +68,7 @@
for (boundary = 0; boundary < 16; boundary++) {
for (depth = 8; depth <= 12; depth += 2) {
+ const unsigned int max_pos = size * size >> (depth == 8);
for (pridamping = 3 + depth - 8;
pridamping < 7 - 3 * !!boundary + depth - 8; pridamping++) {
for (secdamping = 3 + depth - 8;
@@ -124,10 +125,7 @@
pristrength, secstrength, dir, pridamping,
secdamping, bsize, (1 << depth) - 1));
if (ref_cdef != cdef) {
- for (pos = 0;
- pos<sizeof(d) / sizeof(*d)>> (depth == 8) &&
- !error;
- pos++) {
+ for (pos = 0; pos < max_pos && !error; pos++) {
error = ref_d[pos] != d[pos];
errdepth = depth;
errpristrength = pristrength;