|
From: <sv...@op...> - 2026-05-20 16:30:47
|
Author: manx Date: Wed May 20 18:30:40 2026 New Revision: 25334 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=25334 Log: [Imp] mpt/base/math.hpp: Provide mpt::lround and mpt::llround, like C++11 std::lround and std::llround. Modified: trunk/OpenMPT/src/mpt/base/math.hpp Modified: trunk/OpenMPT/src/mpt/base/math.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/base/math.hpp Wed May 20 17:45:31 2026 (r25333) +++ trunk/OpenMPT/src/mpt/base/math.hpp Wed May 20 18:30:40 2026 (r25334) @@ -43,6 +43,50 @@ #if MPT_OS_DJGPP +inline long lround(const long double val) { + return ::lroundl(val); +} + +inline long lround(const double val) { + return ::lround(val); +} + +inline long lround(const float val) { + return ::lroundf(val); +} + +#else // !MPT_OS_DJGPP + +// C++11 std::lround +using std::lround; + +#endif // MPT_OS_DJGPP + + +#if MPT_OS_DJGPP + +inline long long llround(const long double val) { + return ::llroundl(val); +} + +inline long long llround(const double val) { + return ::llround(val); +} + +inline long long llround(const float val) { + return ::llroundf(val); +} + +#else // !MPT_OS_DJGPP + +// C++11 std::llround +using std::llround; + +#endif // MPT_OS_DJGPP + + +#if MPT_OS_DJGPP + inline long double round(const long double val) { return ::roundl(val); } |