mirror of
https://github.com/nginx/nginx.git
synced 2024-12-05 06:19:01 +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)
|
||||
{
|
||||
u_char *p;
|
||||
ngx_uint_t len;//, len2;
|
||||
ngx_uint_t bits, len;
|
||||
|
||||
p = *pos;
|
||||
len = 0;
|
||||
bits = 0;
|
||||
|
||||
while (value >> ((1 << len) * 8 - 2)) {
|
||||
len++;
|
||||
while (value >> ((8 << bits) - 2)) {
|
||||
bits++;
|
||||
}
|
||||
|
||||
*p = len << 6;
|
||||
len = (1 << bits);
|
||||
|
||||
// len2 =
|
||||
len = (1 << len);
|
||||
len--;
|
||||
*p |= value >> (len * 8);
|
||||
p++;
|
||||
|
||||
while (len) {
|
||||
*p++ = value >> ((len-- - 1) * 8);
|
||||
while (len--) {
|
||||
*p++ = value >> (len * 8);
|
||||
}
|
||||
|
||||
**pos |= bits << 6;
|
||||
*pos = p;
|
||||
// return len2;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user