Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Fix integer overflow during multiplication with realtic_clock_rate #476

Merged
merged 1 commit into from
Feb 15, 2022
Merged

Conversation

jengelh
Copy link
Contributor

@jengelh jengelh commented Feb 15, 2022

When the program has run for about 26 minutes and SDL_GetTicks has
accrued a reasonably large value, multiplication by realtic_clock_rate
overflows "int" on contemporary platforms, manifesting in jagged
motion.

Fixes: v2.6.1um-29-ga7bafe07
Closes #471

Copy link
Collaborator

@fabiangreffrath fabiangreffrath left a comment

Choose a reason for hiding this comment

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

Very good catch! Please fix I_TickElapsedTime_RealTime() as well while at it.

When the program has run for about 26 minutes and SDL_GetTicks has
accrued a reasonably large value, multiplication by realtic_clock_rate
overflows "int" on contemporary platforms, manifesting in jagged
motion.

Fixes: v2.6.1um-29-ga7bafe07
Closes #471
@jengelh
Copy link
Contributor Author

jengelh commented Feb 15, 2022

I_TickElapsedTime_RealTime would overflow only after 17h, but yeah, there's that 23-day program runtime ;-)

@fabiangreffrath fabiangreffrath merged commit 247c27d into coelckers:master Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stuttering when running at reduced gamespeed
2 participants