summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-09-09 12:58:12 -0400
committerNick Mathewson <nickm@torproject.org>2011-09-09 12:58:12 -0400
commita41f1fc6127a688485b90c1fc2bfcbeb59e41f0b (patch)
tree452abe6e161edc285fea830df0039a1f4efb6de4 /src/common
parentd3ff167e098fa44e4ec30c7e6f50127a8c99dae7 (diff)
parentb0695c11ebfff4ca4dc6570e49e27c03ca65e8ab (diff)
downloadtor-a41f1fc6127a688485b90c1fc2bfcbeb59e41f0b.tar.gz
tor-a41f1fc6127a688485b90c1fc2bfcbeb59e41f0b.zip
Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts: configure.in src/or/circuitbuild.c
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 ae7d7cfc09..62e4a07035 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 db6b00f085..df77c33ff1 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -338,10 +338,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
}