Thread (1 message) 1 message, 1 author, 2016-09-26

Re: [PATCH rdma-core 2/5] utils: Create utils directory to put all common code and move min/max into it

From: Jason Gunthorpe <hidden>
Date: 2016-09-26 17:20:06

On Sun, Sep 25, 2016 at 09:50:04AM +0300, Leon Romanovsky wrote:
-#ifndef min
-#define min(a, b) \
-	({ typeof(a) _a = (a); \
-	   typeof(b) _b = (b); \
-	   _a < _b ? _a : _b; })
-#endif
-
-#ifndef max
-#define max(a, b) \
-	({ typeof(a) _a = (a); \
-	   typeof(b) _b = (b); \
-	   _a > _b ? _a : _b; })
-#endif
I'm not excited to replace the safer min above with the less safe min
below, that could actually break something.
+/*
+ * This include contains all common mathematical functions
+ */
+#ifndef min
+#define min(a, b)	(((a) < (b)) ? (a) : (b))
+#endif
+
+#ifndef max
+#define max(a, b) 	(((a) > (b)) ? (a) : (b))
+#endif
+#endif /* _RDMA_MATH_H_ */
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help