'roundf()' wasn't introduced in MSVC until VS2013 - so for the time being, let's...
authorJohn Emmas <johne53@tiscali.co.uk>
Fri, 19 Aug 2016 09:19:32 +0000 (10:19 +0100)
committerJohn Emmas <johne53@tiscali.co.uk>
Fri, 19 Aug 2016 13:11:00 +0000 (14:11 +0100)
libs/pbd/msvc/msvc_pbd.cc
libs/pbd/pbd/msvc_pbd.h
msvc_extra_headers/ardourext/misc.h.input

index f49ac5393c85743306c0cf644ee1bcde43166a34..68596e3463ab4c8b20fbb24e9e9cf263def2bc35 100644 (file)
@@ -223,6 +223,24 @@ ssize_t ret;
        return (ret);
 }
 
+//***************************************************************
+//
+//     roundf()
+//
+// Emulates roundf() using floorf().
+//
+//     Returns:
+//
+//    On Success: The largest integer that is less than or
+//                equal to 'x'.
+//    On Failure: None
+//
+LIBPBD_API float PBD_APICALLTYPE
+roundf(float x)
+{
+       return (floorf(x));
+}
+
 //***************************************************************
 //
 //     round()
index 5a6b5502427c12030adc460a43c83eceeb3be5b4..1a017fcb8ae61e74d160e9f153f50c9d4c3bc268 100644 (file)
@@ -230,6 +230,7 @@ LIBPBD_API int                              __cdecl         gettimeofday(struct timeval *__restrict tv, __
 LIBPBD_API ssize_t                     PBD_APICALLTYPE pread(int handle, void *buf, size_t nbytes, off_t offset);
 LIBPBD_API ssize_t                     PBD_APICALLTYPE pwrite(int handle, const void *buf, size_t nbytes, off_t offset);
 LIBPBD_API int                         PBD_APICALLTYPE poll(struct pollfd *fds, nfds_t nfds, int timeout);
+LIBPBD_API float                       PBD_APICALLTYPE roundf(float x);
 LIBPBD_API double                      PBD_APICALLTYPE round(double x);
 LIBPBD_API double                      PBD_APICALLTYPE trunc(double x);
 
index 11ba6384943216c81f35dd5251d2a76f81667f24..6b6533b510eca0fe36df2bfcf07076a579964d36 100644 (file)
@@ -253,6 +253,7 @@ inline int64_t abs(int64_t val) throw()
 
 #if !defined(LIBPBD_API) || defined(PBD_IS_IN_WIN_STATIC_LIB)
 extern  double round(double x);
+extern  float roundf(float x);
 
 // Emulate some C99 math functions which MSVC itself didn't
 // implement until later in life.