aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-09-09 12:54:27 -0400
committerNick Mathewson <nickm@torproject.org>2011-09-09 12:54:27 -0400
commitb0695c11ebfff4ca4dc6570e49e27c03ca65e8ab (patch)
tree357aeae2792ebebbe8045c2045b65e7f3384a427 /src/common
parent4467799f45346a59c37de9337b24ace361cb8b6a (diff)
parent45ca0d2bfacc2ab54a5eb580ba8993a6919906a3 (diff)
downloadtor-b0695c11ebfff4ca4dc6570e49e27c03ca65e8ab.tar.gz
tor-b0695c11ebfff4ca4dc6570e49e27c03ca65e8ab.zip
Merge remote-tracking branch 'public/gcc-295-fix' into maint-0.2.2
Diffstat (limited to 'src/common')
-rw-r--r--src/common/torgzip.c3
-rw-r--r--src/common/util.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/src/common/torgzip.c b/src/common/torgzip.c
index 2937c67de2..a26e5b21e5 100644
--- a/src/common/torgzip.c
+++ b/src/common/torgzip.c
@@ -14,11 +14,12 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include "torint.h"
+
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
-#include "torint.h"
#include "util.h"
#include "torlog.h"
#include "torgzip.h"
diff --git a/src/common/util.c b/src/common/util.c
index ee0acbbb07..de1ca3684d 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -334,10 +334,12 @@ tor_mathlog(double d)
long
tor_lround(double d)
{
-#ifdef _MSC_VER
- return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
-#else
+#if defined(HAVE_LROUND)
return lround(d);
+#elif defined(HAVE_RINT)
+ return (long)rint(d);
+#else
+ return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
#endif
}