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

Single-file libs now include dictBuilder #2212

Merged
merged 2 commits into from
Jun 22, 2020

Conversation

cwoffenden
Copy link
Contributor

The dictBuilder sources were missing from the single-file libs, as per #2211. This PR:

  • Adds the missing files to the generator script's input
  • Fixes the duplicate 'console' macros and vars
  • Fixes the duplicate hash functions

I'm not 100% happy with the approach for fixing the macros (adding #undefs) since it adds noise around the definitions. That said... I'm not sure pulling out that code into a shared header would be any cleaner.

The hash functions were already present in zstd_compress_internal.h but instead of relying on those the choice was to prefix (with COVER_ or FASTCOVER_ accordingly). This was felt to be cleaner (than detecting ZSTD_COMPRESS_H, which felt like introducing future breakage).

Copy link
Contributor

@terrelln terrelln left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for doing this!



/**
* Hash the d-byte value pointed to by p and mod 2^f
*/
static size_t FASTCOVER_hashPtrToIndex(const void* p, U32 h, unsigned d) {
if (d == 6) {
return ZSTD_hash6Ptr(p, h) & ((1 << h) - 1);
return FASTCOVER_hash6Ptr(p, h) & ((1 << h) - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, this & ((1 << h) -1) is completely redundant. I will put up a separate PR to remove it.

@terrelln terrelln merged commit 78601d0 into facebook:dev Jun 22, 2020
@cwoffenden cwoffenden deleted the single-file-dict branch June 22, 2020 20:43
@cwoffenden cwoffenden restored the single-file-dict branch June 29, 2020 05:23
@cwoffenden cwoffenden deleted the single-file-dict branch June 29, 2020 06:16
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