Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
0e1d0400
Commit
0e1d0400
authored
Aug 16, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use whole chunk when performing huffman encoding
parent
afdd51ff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
4 deletions
+33
-4
lib/nghttp2_hd_huffman.c
lib/nghttp2_hd_huffman.c
+33
-4
No files found.
lib/nghttp2_hd_huffman.c
View file @
0e1d0400
...
...
@@ -64,15 +64,44 @@ static ssize_t huff_encode_sym(nghttp2_bufs *bufs, size_t *avail_ptr,
code
<<=
8
-
(
nbits
&
0x7
);
}
/* we lose at most 3 bytes, but it is not critical in practice */
if
(
*
avail_ptr
<
(
nbits
+
7
)
/
8
)
{
rv
=
nghttp2_bufs_advance
(
bufs
);
/* slow path */
if
(
nbits
>
24
)
{
rv
=
nghttp2_bufs_addb
(
bufs
,
(
uint8_t
)(
code
>>
24
));
if
(
rv
!=
0
)
{
return
rv
;
}
nbits
-=
8
;
}
if
(
nbits
>
16
)
{
rv
=
nghttp2_bufs_addb
(
bufs
,
(
uint8_t
)(
code
>>
16
));
if
(
rv
!=
0
)
{
return
rv
;
}
nbits
-=
8
;
}
if
(
nbits
>
8
)
{
rv
=
nghttp2_bufs_addb
(
bufs
,
(
uint8_t
)(
code
>>
8
));
if
(
rv
!=
0
)
{
return
rv
;
}
nbits
-=
8
;
}
if
(
nbits
==
8
)
{
rv
=
nghttp2_bufs_addb
(
bufs
,
(
uint8_t
)
code
);
if
(
rv
!=
0
)
{
return
rv
;
}
*
avail_ptr
=
nghttp2_bufs_cur_avail
(
bufs
);
/* we assume that we at least 3 buffer space available */
assert
(
*
avail_ptr
>=
3
);
return
8
;
}
rv
=
nghttp2_bufs_addb_hold
(
bufs
,
(
uint8_t
)
code
);
if
(
rv
!=
0
)
{
return
rv
;
}
*
avail_ptr
=
nghttp2_bufs_cur_avail
(
bufs
);
return
(
ssize_t
)(
8
-
nbits
);
}
/* fast path, since most code is less than 8 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment