13
0

For MSVC builds, implement 'rint()' and 'rintf()' to supplement the ones that were already implemented

This commit is contained in:
John Emmas 2015-04-24 19:11:10 +01:00
parent 4e36760bac
commit 8b5474b9e1
4 changed files with 24 additions and 13 deletions

View File

@ -57,10 +57,6 @@
#include "utils_videotl.h" #include "utils_videotl.h"
#include "i18n.h" #include "i18n.h"
#ifdef COMPILER_MSVC
#define rintf(x) round((x) + 0.5)
#endif
using namespace Gtk; using namespace Gtk;
using namespace std; using namespace std;
using namespace PBD; using namespace PBD;

View File

@ -21,10 +21,6 @@
#include "gtk2ardour-config.h" #include "gtk2ardour-config.h"
#endif #endif
#ifdef COMPILER_MSVC
#define rintf(x) round((x) + 0.5)
#endif
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <set> #include <set>

View File

@ -56,6 +56,18 @@
return intgr ; return intgr ;
} }
__inline double
rint (double flt)
{ long long int intgr;
_asm
{ fld flt
fistp intgr
} ;
return (double) intgr ;
}
__inline long int __inline long int
lrintf (float flt) lrintf (float flt)
{ int intgr; { int intgr;
@ -68,6 +80,18 @@
return intgr ; return intgr ;
} }
__inline float
rintf (float flt)
{ int intgr;
_asm
{ fld flt
fistp intgr
} ;
return (float) intgr ;
}
__inline long long int __inline long long int
llrint (double flt) llrint (double flt)
{ long long int intgr; { long long int intgr;

View File

@ -247,11 +247,6 @@ inline int64_t abs(int64_t val) throw()
extern bool operator == (const Type& lhs, const Type& rhs); extern bool operator == (const Type& lhs, const Type& rhs);
#endif #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) #if !defined(LIBPBD_API) || defined(PBD_IS_IN_WIN_STATIC_LIB)
extern double round(double x); extern double round(double x);