mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-15 08:11:46 -06:00
Update fast-lzma2 to version 1.0.1
This commit is contained in:
@@ -13,8 +13,6 @@
|
||||
#include "fl2_internal.h"
|
||||
#include "radix_internal.h"
|
||||
|
||||
typedef struct FL2_matchTable_s FL2_matchTable;
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
@@ -22,38 +20,38 @@ typedef struct FL2_matchTable_s FL2_matchTable;
|
||||
|
||||
#define RADIX_MAX_LENGTH BITPACK_MAX_LENGTH
|
||||
|
||||
#define InitMatchLink(index, link) tbl->table[index] = link
|
||||
#define InitMatchLink(pos, link) tbl->table[pos] = link
|
||||
|
||||
#define GetMatchLink(link) (tbl->table[link] & RADIX_LINK_MASK)
|
||||
|
||||
#define GetInitialMatchLink(index) tbl->table[index]
|
||||
#define GetInitialMatchLink(pos) tbl->table[pos]
|
||||
|
||||
#define GetMatchLength(index) (tbl->table[index] >> RADIX_LINK_BITS)
|
||||
#define GetMatchLength(pos) (tbl->table[pos] >> RADIX_LINK_BITS)
|
||||
|
||||
#define SetMatchLink(index, link, length) tbl->table[index] = (link) | ((U32)(length) << RADIX_LINK_BITS)
|
||||
#define SetMatchLink(pos, link, length) tbl->table[pos] = (link) | ((U32)(length) << RADIX_LINK_BITS)
|
||||
|
||||
#define SetMatchLength(index, link, length) tbl->table[index] = (link) | ((U32)(length) << RADIX_LINK_BITS)
|
||||
#define SetMatchLength(pos, link, length) tbl->table[pos] = (link) | ((U32)(length) << RADIX_LINK_BITS)
|
||||
|
||||
#define SetMatchLinkAndLength(index, link, length) tbl->table[index] = (link) | ((U32)(length) << RADIX_LINK_BITS)
|
||||
#define SetMatchLinkAndLength(pos, link, length) tbl->table[pos] = (link) | ((U32)(length) << RADIX_LINK_BITS)
|
||||
|
||||
#define SetNull(index) tbl->table[index] = RADIX_NULL_LINK
|
||||
#define SetNull(pos) tbl->table[pos] = RADIX_NULL_LINK
|
||||
|
||||
#define IsNull(index) (tbl->table[index] == RADIX_NULL_LINK)
|
||||
#define IsNull(pos) (tbl->table[pos] == RADIX_NULL_LINK)
|
||||
|
||||
BYTE* RMF_bitpackAsOutputBuffer(FL2_matchTable* const tbl, size_t const index)
|
||||
BYTE* RMF_bitpackAsOutputBuffer(FL2_matchTable* const tbl, size_t const pos)
|
||||
{
|
||||
return (BYTE*)(tbl->table + index);
|
||||
return (BYTE*)(tbl->table + pos);
|
||||
}
|
||||
|
||||
/* Restrict the match lengths so that they don't reach beyond index */
|
||||
void RMF_bitpackLimitLengths(FL2_matchTable* const tbl, size_t const index)
|
||||
/* Restrict the match lengths so that they don't reach beyond pos */
|
||||
void RMF_bitpackLimitLengths(FL2_matchTable* const tbl, size_t const pos)
|
||||
{
|
||||
DEBUGLOG(5, "RMF_limitLengths : end %u, max length %u", (U32)index, RADIX_MAX_LENGTH);
|
||||
SetNull(index - 1);
|
||||
for (U32 length = 2; length < RADIX_MAX_LENGTH && length <= index; ++length) {
|
||||
U32 const link = tbl->table[index - length];
|
||||
DEBUGLOG(5, "RMF_limitLengths : end %u, max length %u", (U32)pos, RADIX_MAX_LENGTH);
|
||||
SetNull(pos - 1);
|
||||
for (U32 length = 2; length < RADIX_MAX_LENGTH && length <= pos; ++length) {
|
||||
U32 const link = tbl->table[pos - length];
|
||||
if (link != RADIX_NULL_LINK)
|
||||
tbl->table[index - length] = (MIN(length, link >> RADIX_LINK_BITS) << RADIX_LINK_BITS) | (link & RADIX_LINK_MASK);
|
||||
tbl->table[pos - length] = (MIN(length, link >> RADIX_LINK_BITS) << RADIX_LINK_BITS) | (link & RADIX_LINK_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user