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

[tor-commits] [stegotorus/master] Now compiles on OSX _and_ Linux



commit 0e8274174b022edc2c92b00b89955b4796d68c82
Author: Zack Weinberg <zackw@xxxxxxxxx>
Date:   Wed Mar 21 09:00:09 2012 -0700

    Now compiles on OSX _and_ Linux
---
 src/rng.cc |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/rng.cc b/src/rng.cc
index 4901c33..9b7ff57 100644
--- a/src/rng.cc
+++ b/src/rng.cc
@@ -6,12 +6,9 @@
 #include "rng.h"
 
 #include <limits>
-#include <math.h>
+#include <cmath>
 #include <cryptopp/osrng.h>
 
-/* not sure why, but on OSX we only see std::isnan, not ::isnan */
-using std::isnan;
-
 /* Note: this file wraps a C++ library into a C-style program and must
    insulate that program from C++ semantics it is not prepared to handle;
    most importantly, all exceptions must be converted to error codes. */
@@ -202,6 +199,13 @@ rng_double()
 int
 rng_range_geom(unsigned int hi, unsigned int xv)
 {
+  using std::exp;
+  using std::log;
+  using std::floor;
+  using std::isnan;
+  using std::min;
+  using std::max;
+
   log_assert(hi <= ((unsigned int)INT_MAX)+1);
   log_assert(0 < xv && xv < hi);
 
@@ -228,5 +232,5 @@ rng_range_geom(unsigned int hi, unsigned int xv)
 
   /* Round down for the geometric distribution, and clamp to [0, hi)
      for great defensiveness. */
-  return std::min(hi-1, std::max(0U, (unsigned int)floor(T)));
+  return min(hi-1, max(0U, (unsigned int)floor(T)));
 }



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