Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HUF_writeCTable_wksp() function #2523

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

terrelln
Copy link
Contributor

@terrelln terrelln commented Mar 5, 2021

This saves ~700 bytes of stack space in HUF_writeCTable() by adding a workspace variant and using it in the HUF_compress_internal().

@@ -732,7 +751,10 @@ static size_t HUF_compressCTable_internal(
typedef struct {
unsigned count[HUF_SYMBOLVALUE_MAX + 1];
HUF_CElt CTable[HUF_SYMBOLVALUE_MAX + 1];
HUF_buildCTable_wksp_tables buildCTable_wksp;
union {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, nameless union is not a C90 feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bummer, I'll name it then

@terrelln terrelln force-pushed the huf-stack-reduction branch from 13e2dda to 5df2a21 Compare March 5, 2021 18:25
This saves ~700 bytes of stack space in HUF_writeCTable.
@terrelln terrelln merged commit b5fd348 into facebook:dev Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants