13
0

'roundf()' wasn't introduced in MSVC until VS2013 - so for the time being, let's emulate it using 'floorf()'

This commit is contained in:
John Emmas 2016-08-19 10:19:32 +01:00
parent 5cc97f55f2
commit a0b117b948
3 changed files with 20 additions and 0 deletions

View 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()

View 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);

View 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.