diff options
Diffstat (limited to 'cmake/msvc/config.h')
-rw-r--r-- | cmake/msvc/config.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h index 71e94c832..43792c783 100644 --- a/cmake/msvc/config.h +++ b/cmake/msvc/config.h @@ -21,10 +21,13 @@ typedef ptrdiff_t ssize_t; //////////////////////////////////////////////////////////////////////// // rint functions //////////////////////////////////////////////////////////////////////// +#include <math.h> static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);} static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);} -static inline double rint(double x){return (double)lrint(x);} -static inline float rintf(float x){return (float)lrintf(x);} +static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5 : x - 0.5);} +static inline long long llrintf(float x){return (long long)(x > 0.0f ? x + 0.5f : x - 0.5f);} +static inline double rint(double x){return (x > 0.0)? floor(x + 0.5) : ceil(x - 0.5);} +static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x - 0.5f);} //////////////////////////////////////////////////////////////////////// // math constants |