[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-dev] lround() missing in MSVC



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

_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev