aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-02 09:39:57 -0700
committerChris Robinson <[email protected]>2018-11-02 19:16:45 -0700
commit515bc4ba53c81d375e9a96dc62398c62d36d56c0 (patch)
tree20ab8fd17f423ff5abfb3a11b5cb1b09694993ff
parent25dfe4b57a0042008748bb3521a8f5efe297c5db (diff)
Workaround lack of roundf with early MSVC
-rw-r--r--Alc/mastering.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Alc/mastering.c b/Alc/mastering.c
index f6ed9242..6745c1c7 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");