Welcome! Log In Create A New Profile

Advanced

[nginx] Macro ngx_max/ngx_min improved

May 01, 2017 11:22PM
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.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Macro ngx_max/ngx_min improved

karton 697 May 01, 2017 11:22PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 171
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready