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

2.0.x
Eyal 6 years ago committed by Scott Lahteine
parent 14e2b11195
commit fbdbe53290

@ -694,7 +694,9 @@ void Planner::init() {
// 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.
// 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

Loading…
Cancel
Save