[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/release-0.3.1] Merge branch 'bug22801_028' into maint-0.2.9
commit bb97f680e74170673246b3de32e847ade46840f2
Merge: ec9c6d7 5361032
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Jul 5 11:18:59 2017 -0400
Merge branch 'bug22801_028' into maint-0.2.9
changes/bug22801 | 5 +++++
src/common/util.c | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --cc src/common/util.c
index a7bce2e,b2b9761..b7468df
--- a/src/common/util.c
+++ b/src/common/util.c
@@@ -5693,8 -5535,17 +5693,17 @@@ tor_weak_random_range(tor_weak_rng_t *r
int64_t
clamp_double_to_int64(double number)
{
- int exp;
+ int exponent;
+ #if defined(__MINGW32__) || defined(__MINGW64__)
+ /*
+ Mingw's math.h uses gcc's __builtin_choose_expr() facility to declare
+ isnan, isfinite, and signbit. But as implemented in at least some
+ versions of gcc, __builtin_choose_expr() can generate type warnings
+ even from branches that are not taken. So, suppress those warnings.
+ */
+ DISABLE_GCC_WARNING(float-conversion)
+ #endif
/* NaN is a special case that can't be used with the logic below. */
if (isnan(number)) {
return 0;
@@@ -5720,26 -5571,8 +5729,29 @@@
/* Handle infinities and finite numbers with magnitude >= 2^63. */
return signbit(number) ? INT64_MIN : INT64_MAX;
+ #if defined(__MINGW32__) || defined(__MINGW64__)
+ ENABLE_GCC_WARNING(float-conversion)
+ #endif
}
+/** Return a uint64_t value from <b>a</b> in network byte order. */
+uint64_t
+tor_htonll(uint64_t a)
+{
+#ifdef WORDS_BIGENDIAN
+ /* Big endian. */
+ return a;
+#else /* WORDS_BIGENDIAN */
+ /* Little endian. The worst... */
+ return htonl((uint32_t)(a>>32)) |
+ (((uint64_t)htonl((uint32_t)a))<<32);
+#endif /* WORDS_BIGENDIAN */
+}
+
+/** Return a uint64_t value from <b>a</b> in host byte order. */
+uint64_t
+tor_ntohll(uint64_t a)
+{
+ return tor_htonll(a);
+}
+
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits