Browse Source

Correct over optimization of pre-initialized variables (#6500)

* Correct over optimization of pre-initialized variables

NEAR_ZERO() works most of the time...  But it leaves corner cases
uncovered.  We need to explicitly check if these variables are +/-
infinity.

* Correct over optimization of pre-initialized variables
Roxy-3D 7 years ago
parent
commit
2509587b5a
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      Marlin/ubl_motion.cpp

+ 5
- 3
Marlin/ubl_motion.cpp View File

250
     const float m = dy / dx,
250
     const float m = dy / dx,
251
                 c = start[Y_AXIS] - m * start[X_AXIS];
251
                 c = start[Y_AXIS] - m * start[X_AXIS];
252
 
252
 
253
-    const bool inf_normalized_flag = NEAR_ZERO(on_axis_distance),
254
-               inf_m_flag = NEAR_ZERO(dx);
253
+    bool inf_normalized_flag, inf_m_flag; 
254
+
255
+    inf_normalized_flag = isinf(e_normalized_dist);
256
+    inf_m_flag = isinf(m);
255
 
257
 
256
     /**
258
     /**
257
      * This block handles vertical lines. These are lines that stay within the same
259
      * This block handles vertical lines. These are lines that stay within the same
265
         const float next_mesh_line_y = LOGICAL_Y_POSITION(pgm_read_float(&(ubl.mesh_index_to_ypos[current_yi])));
267
         const float next_mesh_line_y = LOGICAL_Y_POSITION(pgm_read_float(&(ubl.mesh_index_to_ypos[current_yi])));
266
 
268
 
267
         /**
269
         /**
268
-         * inf_m_flag? the slope of the line is infinite, we won't do the calculations
270
+         * if the slope of the line is infinite, we won't do the calculations
269
          * else, we know the next X is the same so we can recover and continue!
271
          * else, we know the next X is the same so we can recover and continue!
270
          * Calculate X at the next Y mesh line
272
          * Calculate X at the next Y mesh line
271
          */
273
          */

Loading…
Cancel
Save