Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend ticks calculation in timer start from u32 to u64 #343

Closed
wants to merge 1 commit into from

Conversation

apatrushev
Copy link
Contributor

Fixes #342

@@ -279,9 +279,9 @@ where
let timeout: Self::Time = timeout.into();
let clock = TIM::clock(&self.clocks);

let ticks = clock.integer().saturating_mul(timeout.integer()) * *timeout.scaling_factor();
let ticks = (clock.integer() as u64).saturating_mul(timeout.integer() as u64) * *timeout.scaling_factor();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a good improvement, please use u64::from instead of as casts :)

Suggested change
let ticks = (clock.integer() as u64).saturating_mul(timeout.integer() as u64) * *timeout.scaling_factor();
let ticks = u64::from(clock.integer()).saturating_mul(u64::from(timeout.integer()) * *timeout.scaling_factor();

Sh3Rm4n added a commit that referenced this pull request Nov 28, 2023
Supersedes #343
Fixes #342

Co-authored-by: Anton Patrushev <apatrushev@gmail.com>
@Sh3Rm4n
Copy link
Member

Sh3Rm4n commented Nov 28, 2023

Thanks, I've rebased and merged it in #356

@Sh3Rm4n Sh3Rm4n closed this Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants