Fix get_period_inverse(0) so it doesn't crash (#11334)
This commit is contained in:
parent
14e2b11195
commit
fbdbe53290
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user