From 8b5474b9e13fde1ec6632c32f65a39ecffc5d1d5 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Fri, 24 Apr 2015 19:11:10 +0100 Subject: For MSVC builds, implement 'rint()' and 'rintf()' to supplement the ones that were already implemented --- msvc_extra_headers/ardourext/float_cast.h.input | 24 ++++++++++++++++++++++++ msvc_extra_headers/ardourext/misc.h.input | 5 ----- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'msvc_extra_headers') diff --git a/msvc_extra_headers/ardourext/float_cast.h.input b/msvc_extra_headers/ardourext/float_cast.h.input index 2ba3bbbe62..94433da965 100644 --- a/msvc_extra_headers/ardourext/float_cast.h.input +++ b/msvc_extra_headers/ardourext/float_cast.h.input @@ -56,6 +56,18 @@ return intgr ; } + __inline double + rint (double flt) + { long long int intgr; + + _asm + { fld flt + fistp intgr + } ; + + return (double) intgr ; + } + __inline long int lrintf (float flt) { int intgr; @@ -68,6 +80,18 @@ return intgr ; } + __inline float + rintf (float flt) + { int intgr; + + _asm + { fld flt + fistp intgr + } ; + + return (float) intgr ; + } + __inline long long int llrint (double flt) { long long int intgr; diff --git a/msvc_extra_headers/ardourext/misc.h.input b/msvc_extra_headers/ardourext/misc.h.input index 5da7c41564..9bcba6f327 100644 --- a/msvc_extra_headers/ardourext/misc.h.input +++ b/msvc_extra_headers/ardourext/misc.h.input @@ -247,11 +247,6 @@ inline int64_t abs(int64_t val) throw() extern bool operator == (const Type& lhs, const Type& rhs); #endif -// round().... Unlike Linux, Windows doesn't seem to support the -// concept of a system-wide (or programmable) rounding direction. -// Fortunately, 'round to nearest' seems to be the default action -// under Linux, so let's copy that until we find out otherwise. -#define rint(value) round(value) #if !defined(LIBPBD_API) || defined(PBD_IS_IN_WIN_STATIC_LIB) extern double round(double x); -- cgit v1.2.3