diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-08-24 13:53:17 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-08-24 13:53:17 -0400 |
commit | ede9cd4f99e4cd1c0c4bcf1a3ac994e87054cc2d (patch) | |
tree | e67b9ec15c18f7ab2a652866adcd134d9432727d | |
parent | dd6a9a923d8bda5363c50d5ea7fd8ea403e895cd (diff) | |
parent | 5939c09d35de5be4b135bb0ad6dde24700e75fc2 (diff) | |
download | tor-ede9cd4f99e4cd1c0c4bcf1a3ac994e87054cc2d.tar.gz tor-ede9cd4f99e4cd1c0c4bcf1a3ac994e87054cc2d.zip |
Merge remote-tracking branch 'origin/maint-0.2.2'
-rw-r--r-- | changes/msvc_lround | 4 | ||||
-rw-r--r-- | src/common/util.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/changes/msvc_lround b/changes/msvc_lround new file mode 100644 index 0000000000..e4aea95351 --- /dev/null +++ b/changes/msvc_lround @@ -0,0 +1,4 @@ + o Build fixes: + - Provide a substitute implementation of lround() for MSVC, which + apparently lacks it. Patch from Gisle Vanem. + diff --git a/src/common/util.c b/src/common/util.c index c387318c0e..81d31f6026 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -335,7 +335,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. */ |