Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4583 - trunk/src/core

Anonymous User
April 11, 2012 01:20PM
Author: ru
Date: 2012-04-11 17:18:15 +0000 (Wed, 11 Apr 2012)
New Revision: 4583
URL: http://trac.nginx.org/nginx/changeset/4583/nginx

Log:
Improved readability of the code that produces bitmask from prefix.
In collaboration with Maxim Dounin.


Modified:
trunk/src/core/ngx_inet.c

Modified: trunk/src/core/ngx_inet.c
===================================================================
--- trunk/src/core/ngx_inet.c 2012-04-11 09:56:30 UTC (rev 4582)
+++ trunk/src/core/ngx_inet.c 2012-04-11 17:18:15 UTC (rev 4583)
@@ -420,7 +420,7 @@
s = (shift > 8) ? 8 : shift;
shift -= s;

- mask[i] = (u_char) (0 - (1 << (8 - s)));
+ mask[i] = (u_char) (0xffu << (8 - s));

if (addr[i] != (addr[i] & mask[i])) {
rc = NGX_DONE;
@@ -437,7 +437,7 @@
}

if (shift) {
- cidr->u.in.mask = htonl((ngx_uint_t) (0 - (1 << (32 - shift))));
+ cidr->u.in.mask = htonl((uint32_t) (0xffffffffu << (32 - shift)));

} else {
/* x86 compilers use a shl instruction that shifts by modulo 32 */

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4583 - trunk/src/core

Anonymous User 954 April 11, 2012 01:20PM



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

Online Users

Guests: 322
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