-fix #3870
[oweals/gnunet.git] / src / util / bandwidth.c
index ceec09b52be5c65eb93920ef1fe888b997d0d4d9..3b9b64239b9a12a1167a6ed671a0474991ba961c 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2010, 2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2010, 2013 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -61,7 +61,26 @@ GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1,
 {
   return
       GNUNET_BANDWIDTH_value_init (GNUNET_MIN
-                                   (ntohl (b1.value__), ntohl (b2.value__)));
+                                   (ntohl (b1.value__),
+                                    ntohl (b2.value__)));
+}
+
+
+/**
+ * Compute the MAX of two bandwidth values.
+ *
+ * @param b1 first value
+ * @param b2 second value
+ * @return the min of b1 and b2
+ */
+struct GNUNET_BANDWIDTH_Value32NBO
+GNUNET_BANDWIDTH_value_max (struct GNUNET_BANDWIDTH_Value32NBO b1,
+                            struct GNUNET_BANDWIDTH_Value32NBO b2)
+{
+  return
+      GNUNET_BANDWIDTH_value_init (GNUNET_MAX
+                                   (ntohl (b1.value__),
+                                    ntohl (b2.value__)));
 }