From 0ac4b0f99d12a76f07f24d747a77f2bc07e481e3 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Aug 2011 22:22:15 -0400 Subject: Check for lround with autoconf; fall back to rint. --- src/common/util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/common') 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 } -- cgit v1.2.3-54-g00ecf