mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
Simulate 'trunc()' which isn't available in MSVC
(needed by 'gtk2_ardour/editor.cc')
This commit is contained in:
parent
018f559aad
commit
c7ddedc5b8
2 changed files with 22 additions and 0 deletions
|
|
@ -241,6 +241,27 @@ round(double x)
|
|||
return (floor(x));
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
//
|
||||
// trunc()
|
||||
//
|
||||
// Emulates trunc() using floor() and ceil().
|
||||
//
|
||||
// Returns:
|
||||
//
|
||||
// On Success: The largest integer whose magnitude is less
|
||||
// than or equal to 'x' (regardless of sign).
|
||||
// On Failure: None
|
||||
//
|
||||
LIBPBD_API double PBD_APICALLTYPE
|
||||
trunc(double x)
|
||||
{
|
||||
if (x < 0)
|
||||
return (ceil(x));
|
||||
|
||||
return (floor(x));
|
||||
}
|
||||
|
||||
namespace PBD {
|
||||
|
||||
//***************************************************************
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ LIBPBD_API ssize_t PBD_APICALLTYPE pread(int handle, void *buf, size_t nbytes,
|
|||
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 double PBD_APICALLTYPE round(double x);
|
||||
LIBPBD_API double PBD_APICALLTYPE trunc(double x);
|
||||
|
||||
namespace PBD {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue