Преглед изворни кода

Fix get_period_inverse(0) so it doesn't crash (#11334)

Eyal пре 6 година
родитељ
комит
fbdbe53290
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3
    1
      Marlin/src/module/planner.cpp

+ 3
- 1
Marlin/src/module/planner.cpp Прегледај датотеку

694
     // All other 32-bit MPUs can easily do inverse using hardware division,
694
     // All other 32-bit MPUs can easily do inverse using hardware division,
695
     // so we don't need to reduce precision or to use assembly language at all.
695
     // so we don't need to reduce precision or to use assembly language at all.
696
     // This routine, for all other archs, returns 0x100000000 / d ~= 0xFFFFFFFF / d
696
     // This routine, for all other archs, returns 0x100000000 / d ~= 0xFFFFFFFF / d
697
-    static FORCE_INLINE uint32_t get_period_inverse(const uint32_t d) { return 0xFFFFFFFF / d; }
697
+    static FORCE_INLINE uint32_t get_period_inverse(const uint32_t d) {
698
+      return d ? 0xFFFFFFFF / d : 0xFFFFFFFF;
699
+    }
698
   #endif
700
   #endif
699
 #endif
701
 #endif
700
 
702
 

Loading…
Откажи
Сачувај