Skip to content

Commit

Permalink
Fix comparison with u32::MAX for smaller types
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed May 19, 2023
1 parent cd258f9 commit ae9e1f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rp2040-hal/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ macro_rules! impl_delay_traits {
fn delay_us(&mut self, mut us: $t) {
#![allow(unused_comparisons)]
assert!(us >= 0); // Only meaningful for i32
while us > u32::MAX as $t {
while <$t>::MAX as u64 > u32::MAX as u64 && us > u32::MAX as $t {
(*self).delay_us(u32::MAX);
us -= u32::MAX as $t;
}
Expand Down

0 comments on commit ae9e1f5

Please sign in to comment.