Commits

Ondřej Surý  committed cc7587b

Remove some dead code in gd_interpolation.c

  • Participants
  • Parent commits cea4896

Comments (0)

Files changed (1)

File 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.

 					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;