Base: Add fromPercent and toPercent helpers

This commit is contained in:
Kacper Donat
2025-02-20 00:02:06 +01:00
parent 7f984811e8
commit 2f35f1c561
12 changed files with 67 additions and 93 deletions

View File

@@ -143,6 +143,16 @@ inline T toDegrees(T r)
return static_cast<T>((r / M_PI) * 180.0);
}
inline float fromPercent(const long value)
{
return std::roundf(value) / 100.0F;
}
inline long toPercent(float value)
{
return std::lround(100.0 * value);
}
template<class T>
inline T fmod(T numerator, T denominator)
{