Skip to content

Commit 6eeb8c4

Browse files
committed
Ensure denum is not zero in debug build
1 parent 8ce43e5 commit 6eeb8c4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

embedded-hal/src/pwm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ pub trait SetDutyCycle: ErrorType {
9595
/// and that `denom` is not zero.
9696
#[inline]
9797
fn set_duty_cycle_fraction(&mut self, num: u16, denom: u16) -> Result<(), Self::Error> {
98+
debug_assert!(denom != 0);
9899
debug_assert!(num <= denom);
99100
let duty = u32::from(num) * u32::from(self.get_max_duty_cycle()) / u32::from(denom);
100101

0 commit comments

Comments
 (0)