[tor-dev] lround() missing in MSVC
Gisle Vanem
gvanem at broadpark.no
Tue Aug 23 22:27:15 UTC 2011
lround() is missing in MS Visual-C's <math.h>. Not available anywhere.
Here is an easy patch:
--- Git-latest\src\common\util.c Sun Aug 14 13:48:49 2011
+++ src\common\util.c Tue Aug 23 21:15:25 2011
@@ -335,7 +335,11 @@
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. */
----------------
--gv
More information about the tor-dev
mailing list