# HG changeset patch # User Alex Zhang <[email protected]> # Date 1520229178 -28800 # Mon Mar 05 13:52:58 2018 +0800 # Node ID 03ecef37a93d541e55802393636c101a4da14550 # Parent 265c29b0b8b8c54b1c623268481ed85324ce3c79 HTTP/2: used bitwise operation to replace division and modulo.
Signed-off-by: Alex Zhang <[email protected]> diff -r 265c29b0b8b8 -r 03ecef37a93d src/http/v2/ngx_http_v2.c --- a/src/http/v2/ngx_http_v2.c Thu Mar 01 11:42:55 2018 +0300 +++ b/src/http/v2/ngx_http_v2.c Mon Mar 05 13:52:58 2018 +0800 @@ -1094,7 +1094,7 @@ "depends on %ui excl:%ui weight:%ui", h2c->state.sid, depend, excl, weight); - if (h2c->state.sid % 2 == 0 || h2c->state.sid <= h2c->last_sid) { + if (h2c->state.sid & 0x1 == 0 || h2c->state.sid <= h2c->last_sid) { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client sent HEADERS frame with incorrect identifier " "%ui, the last was %ui", h2c->state.sid, h2c->last_sid); diff -r 265c29b0b8b8 -r 03ecef37a93d src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c Thu Mar 01 11:42:55 2018 +0300 +++ b/src/http/v2/ngx_http_v2_filter_module.c Mon Mar 05 13:52:58 2018 +0800 @@ -1149,8 +1149,8 @@ value -= prefix; while (value >= 128) { - *pos++ = value % 128 + 128; - value /= 128; + *pos++ = (value & 0x7f) + 128; + value >>= 7; } *pos++ = (u_char) value;
_______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
