Commits

Ondřej Surý committed cc7587b

Remove some dead code in gd_interpolation.c

Comments (0)

Files changed (1)

src/gd_interpolation.c

 				const gdFixed f_w3 = gd_mulfx(f_f, f_1-f_g);
 				const gdFixed f_w4 = gd_mulfx(f_f, f_g);
 
-				if (n < src_w - 1) {
+				/* The last condition is always true because the if ^^^ */
+				/* if (n < src_w - 1) { */
+				/* 	src_offset_x = m + 1; */
+				/* 	src_offset_y = n; */
+				/* } */
+
+				/* if (m < src_h - 1) { */
+				/* 	src_offset_x = m; */
+				/* 	src_offset_y = n + 1; */
+				/* } */
+
+				/* if (!((n >= src_w - 1) || (m >= src_h - 1))) { */
    1. Ondřej Surý author

      Unless I am missing something the block can only be entered if m is from (0, src_h> and n is from (0, src_w>.

      that means the first condition (n < src_w - 1) has to be always true, the second condition (m < src_h - 1) is also always true,. and the last one is also true becaue (n >= src_w -1) is always false (m >= src_h -1) is also always false. and !(0 || 0) is true, so it's also always true.

      1. Pierre Joye

        The problem here is that m and n has been reverted, see the fix for the bug #64898.

        Can you try the test reported in this bug please? I may have to review the original implementation and be sure that the correct result is processed, also Remi may have found yet another bug in gcc, incorrect results on his architecture, see https://bitbucket.org/libgd/gd-libgd/issue/67/

 					src_offset_x = m + 1;
-					src_offset_y = n;
-				}
-
-				if (m < src_h-1) {
-					src_offset_x = m;
 					src_offset_y = n + 1;
-				}
-
-				if (!((n >= src_w-1) || (m >= src_h-1))) {
-					src_offset_x = m + 1;
-					src_offset_y = n + 1;
-				}
+				/* } */
 				{
 					const int pixel1 = src->tpixels[src_offset_y][src_offset_x];
 					register int pixel2, pixel3, pixel4;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.