[libpng16] Imported from libpng-1.6.24beta02.tar
diff --git a/pngwutil.c b/pngwutil.c
index 665464b..c1751fe 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -2448,7 +2448,7 @@
/* Overflow can occur in the calculation, just select the lowest set
* filter.
*/
- filter_to_do &= 0U-filter_to_do;
+ filter_to_do &= -filter_to_do;
}
else if ((filter_to_do & PNG_FILTER_NONE) != 0 &&
filter_to_do != PNG_FILTER_NONE)
@@ -2477,7 +2477,9 @@
/* It's the only filter so no testing is needed */
{
/* Passing PNG_SIZE_MAX here and below prevents the 'setup' function
- * breaking out of the loop when lmins is exceeded.
+ * breaking out of the loop when lmins is exceeded. Optimizing
+ * compilers should notice that we don't use the returned sum, and
+ * therefore 'setup' should refrain from calculating and returning "sum".
*/
(void) png_setup_sub_row(png_ptr, bpp, row_bytes, PNG_SIZE_MAX);
best_row = png_ptr->try_row;