aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mastering.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-02 09:39:57 -0700
committerChris Robinson <[email protected]>2018-11-02 09:39:57 -0700
commit9e8e3c146fc80976dd6e547e5267f890713d7a5c (patch)
tree7fed201d1388c3259a2074a59865a9bac5c07ad5 /Alc/mastering.c
parente20d2cdbce2fd696fa65635aa1242a9b614c05cb (diff)
Workaround lack of roundf with early MSVC
Diffstat (limited to 'Alc/mastering.c')
-rw-r--r--Alc/mastering.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Alc/mastering.c b/Alc/mastering.c
index 5b02194a..5ccf3a9e 100644
--- a/Alc/mastering.c
+++ b/Alc/mastering.c
@@ -9,6 +9,18 @@
#include "math_defs.h"
+/* Early MSVC lacks round/roundf */
+#if defined(_MSC_VER) && _MSC_VER < 1800
+static double round(double val)
+{
+ if(val < 0.0)
+ return ceil(val-0.5);
+ return floor(val+0.5);
+}
+#define roundf(f) ((float)round((float)(f)))
+#endif
+
+
/* These structures assume BUFFERSIZE is a power of 2. */
static_assert((BUFFERSIZE & (BUFFERSIZE-1)) == 0, "BUFFERSIZE is not a power of 2");