summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index b47b9c5fa2..ee0acbbb07 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -334,7 +334,11 @@ tor_mathlog(double d)
long
tor_lround(double d)
{
+#ifdef _MSC_VER
+ return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
+#else
return lround(d);
+#endif
}
/** Returns floor(log2(u64)). If u64 is 0, (incorrectly) returns 0. */