1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

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

This commit is contained in:
Eyal 2018-07-25 09:58:40 +03:00 committed by Scott Lahteine
parent 14e2b11195
commit fbdbe53290

View File

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