diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-08-30 22:22:15 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-08-30 22:22:15 -0400 |
commit | 0ac4b0f99d12a76f07f24d747a77f2bc07e481e3 (patch) | |
tree | 35543fe7969e3da794709d411d011c6f42d58731 /src/common | |
parent | 03760f6c6f0c580542c8bfc519062b65afdc8d5f (diff) | |
download | tor-0ac4b0f99d12a76f07f24d747a77f2bc07e481e3.tar tor-0ac4b0f99d12a76f07f24d747a77f2bc07e481e3.tar.gz |
Check for lround with autoconf; fall back to rint.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c index ee0acbbb0..de1ca3684 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 } |