summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2015-04-24 19:11:10 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2015-04-24 19:11:10 +0100
commit8b5474b9e13fde1ec6632c32f65a39ecffc5d1d5 (patch)
tree4b6294c1166b941cb3e9430eda2efdf7df5f8802
parent4e36760bacecb89f0bb48a90cce205671b316022 (diff)
For MSVC builds, implement 'rint()' and 'rintf()' to supplement the ones that were already implemented
-rw-r--r--gtk2_ardour/export_video_dialog.cc4
-rw-r--r--gtk2_ardour/processor_box.cc4
-rw-r--r--msvc_extra_headers/ardourext/float_cast.h.input24
-rw-r--r--msvc_extra_headers/ardourext/misc.h.input5
4 files changed, 24 insertions, 13 deletions
diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc
index e8b823dc90..13f1f8fe4d 100644
--- a/gtk2_ardour/export_video_dialog.cc
+++ b/gtk2_ardour/export_video_dialog.cc
@@ -57,10 +57,6 @@
#include "utils_videotl.h"
#include "i18n.h"
-#ifdef COMPILER_MSVC
-#define rintf(x) round((x) + 0.5)
-#endif
-
using namespace Gtk;
using namespace std;
using namespace PBD;
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index d4c240feaf..e801aaeb74 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -21,10 +21,6 @@
#include "gtk2ardour-config.h"
#endif
-#ifdef COMPILER_MSVC
-#define rintf(x) round((x) + 0.5)
-#endif
-
#include <cmath>
#include <iostream>
#include <set>
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);