Changeset: 0ab440abd87f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0ab440abd87f
Modified Files:
        gdk/gdk_calc.c
Branch: Dec2016
Log Message:

Older Visual Studio doesn't have function round.


diffs (25 lines):

diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -13454,6 +13454,21 @@ convert_##TYPE1##_##TYPE2(const TYPE1 *s
 #define roundflt(x)    roundf(x)
 #define rounddbl(x)    round(x)
 #endif
+
+/* Windows doesn't have round or trunc, but it does have floor and ceil */
+#ifndef HAVE_ROUND
+static inline double
+round(double val)
+{
+       /* round to nearest integer, away from zero */
+       if (val < 0)
+               return -floor(-val + 0.5);
+       else
+               return floor(val + 0.5);
+}
+#define roundf(x)      ((float)round((double)(x)))
+#endif
+
 #define convertimpl_reduce_float(TYPE1, TYPE2)                         \
 static BUN                                                             \
 convert_##TYPE1##_##TYPE2(const TYPE1 *src, TYPE2 *restrict dst, BUN cnt, \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to