frametime fix

This commit is contained in:
Jorijn van der Graaf 2025-12-30 00:44:45 +01:00
commit a220e40d13
2 changed files with 15 additions and 0 deletions

View file

@ -150,14 +150,28 @@ namespace Crafter {
);
}
export constexpr std::int_fast32_t AbsoluteToRelative(std::int_fast32_t absolute, std::int_fast32_t relative) {
return static_cast<std::int_fast32_t>(
(static_cast<__int128>(absolute) * SCALE) / relative
);
}
export constexpr std::int_fast32_t BoundToBoundless(std::int_fast32_t bound) {
return bound * BOUND;
}
export constexpr std::int_fast32_t BoundToBoundlessU(std::int_fast32_t bound) {
return static_cast<std::uint_fast32_t>((bound*2)) * BOUND;
}
export constexpr std::int_fast32_t BoundlessToBound(std::int_fast32_t bound) {
return bound / BOUND;
}
export constexpr std::int_fast32_t BoundlessUToBound(std::uint_fast32_t bound) {
return static_cast<std::int_fast32_t>(bound / 2) / BOUND;
}
export constexpr std::int_fast32_t FractionalToMappedBoundless(double f) {
return std::int_fast32_t(f * SCALEDOUBLEBOUNDLESS);
}