diff options
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/libs/brotli/enc/hash.h')
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-src/libs/brotli/enc/hash.h | 62 |
1 files changed, 55 insertions, 7 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/brotli/enc/hash.h b/Build/source/texk/dvisvgm/dvisvgm-src/libs/brotli/enc/hash.h index 1827ce6019a..26024900c37 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/brotli/enc/hash.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/brotli/enc/hash.h @@ -36,8 +36,10 @@ extern "C" { * * HasherCommon structure * * private structured hasher data, depending on hasher type * * private dynamic hasher data, depending on hasher type and parameters - */ -typedef uint8_t* HasherHandle; + * + * Using "define" instead of "typedef", because on MSVC __restrict does not work + * on typedef pointer types. */ +#define HasherHandle uint8_t* typedef struct { BrotliHasherParams params; @@ -151,14 +153,14 @@ static BROTLI_INLINE BROTLI_BOOL TestStaticDictionaryItem( size_t max_length, size_t max_backward, size_t max_distance, HasherSearchResult* out) { size_t len; - size_t dist; + size_t word_idx; size_t offset; size_t matchlen; size_t backward; score_t score; len = item & 0x1F; - dist = item >> 5; - offset = dictionary->words->offsets_by_length[len] + len * dist; + word_idx = item >> 5; + offset = dictionary->words->offsets_by_length[len] + len * word_idx; if (len > max_length) { return BROTLI_FALSE; } @@ -172,7 +174,7 @@ static BROTLI_INLINE BROTLI_BOOL TestStaticDictionaryItem( size_t cut = len - matchlen; size_t transform_id = (cut << 2) + (size_t)((dictionary->cutoffTransforms >> (cut * 6)) & 0x3F); - backward = max_backward + dist + 1 + + backward = max_backward + 1 + word_idx + (transform_id << dictionary->words->size_bits_by_length[len]); } if (backward > max_distance) { @@ -341,11 +343,57 @@ static BROTLI_INLINE size_t BackwardMatchLengthCode(const BackwardMatch* self) { #undef BUCKET_BITS #undef HASHER +/* fast large window hashers */ + +#define HASHER() HROLLING_FAST +#define CHUNKLEN 32 +#define JUMP 4 +#define NUMBUCKETS 16777216 +#define MASK ((NUMBUCKETS * 64) - 1) +#include "./hash_rolling_inc.h" /* NOLINT(build/include) */ +#undef JUMP +#undef HASHER + + +#define HASHER() HROLLING +#define JUMP 1 +#include "./hash_rolling_inc.h" /* NOLINT(build/include) */ +#undef MASK +#undef NUMBUCKETS +#undef JUMP +#undef CHUNKLEN +#undef HASHER + +#define HASHER() H35 +#define HASHER_A H3 +#define HASHER_B HROLLING_FAST +#include "./hash_composite_inc.h" /* NOLINT(build/include) */ +#undef HASHER_A +#undef HASHER_B +#undef HASHER + +#define HASHER() H55 +#define HASHER_A H54 +#define HASHER_B HROLLING_FAST +#include "./hash_composite_inc.h" /* NOLINT(build/include) */ +#undef HASHER_A +#undef HASHER_B +#undef HASHER + +#define HASHER() H65 +#define HASHER_A H6 +#define HASHER_B HROLLING +#include "./hash_composite_inc.h" /* NOLINT(build/include) */ +#undef HASHER_A +#undef HASHER_B +#undef HASHER + #undef FN #undef CAT #undef EXPAND_CAT -#define FOR_GENERIC_HASHERS(H) H(2) H(3) H(4) H(5) H(6) H(40) H(41) H(42) H(54) +#define FOR_GENERIC_HASHERS(H) H(2) H(3) H(4) H(5) H(6) H(40) H(41) H(42) H(54)\ + H(35) H(55) H(65) #define FOR_ALL_HASHERS(H) FOR_GENERIC_HASHERS(H) H(10) static BROTLI_INLINE void DestroyHasher( |