mirror of
https://github.com/nginx/nginx.git
synced 2025-06-22 13:51:12 +08:00
Improved ngx_quic_build_int() code and readability.
The function now generates somewhat shorter assembler after inlining.
This commit is contained in:
parent
9275f06a57
commit
db90ddcb9e
@ -238,29 +238,23 @@ static void
|
|||||||
ngx_quic_build_int(u_char **pos, uint64_t value)
|
ngx_quic_build_int(u_char **pos, uint64_t value)
|
||||||
{
|
{
|
||||||
u_char *p;
|
u_char *p;
|
||||||
ngx_uint_t len;//, len2;
|
ngx_uint_t bits, len;
|
||||||
|
|
||||||
p = *pos;
|
p = *pos;
|
||||||
len = 0;
|
bits = 0;
|
||||||
|
|
||||||
while (value >> ((1 << len) * 8 - 2)) {
|
while (value >> ((8 << bits) - 2)) {
|
||||||
len++;
|
bits++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p = len << 6;
|
len = (1 << bits);
|
||||||
|
|
||||||
// len2 =
|
while (len--) {
|
||||||
len = (1 << len);
|
*p++ = value >> (len * 8);
|
||||||
len--;
|
|
||||||
*p |= value >> (len * 8);
|
|
||||||
p++;
|
|
||||||
|
|
||||||
while (len) {
|
|
||||||
*p++ = value >> ((len-- - 1) * 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
**pos |= bits << 6;
|
||||||
*pos = p;
|
*pos = p;
|
||||||
// return len2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user