[nginx] Macro ngx_max/ngx_min improved

洪志道 hongzhidao at gmail.com
Tue May 2 03:13:47 UTC 2017


Hi!

Both 'greater' and 'less' are not the lowest priority operations,
we may make a litter improvement as following.

diff -r 29ba1d6a2da9 src/core/ngx_core.h
--- a/src/core/ngx_core.h Tue Apr 04 18:01:57 2017 +0300
+++ b/src/core/ngx_core.h Fri Apr 28 11:27:41 2017 -0400
@@ -97,8 +97,8 @@


 #define ngx_abs(value)       (((value) >= 0) ? (value) : - (value))
-#define ngx_max(val1, val2)  ((val1 < val2) ? (val2) : (val1))
-#define ngx_min(val1, val2)  ((val1 > val2) ? (val2) : (val1))
+#define ngx_max(val1, val2)  ((val1) < (val2) ? (val2) : (val1))
+#define ngx_min(val1, val2)  ((val1) > (val2) ? (val2) : (val1))

 void ngx_cpuinfo(void);

Thanks.
B.R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20170502/a97ef5f7/attachment.html>


More information about the nginx-devel mailing list