mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 14:56:13 +00:00
Changed: liblzma 16.04
This commit is contained in:
parent
840aaba5d4
commit
6c2b248af1
9 changed files with 62 additions and 55 deletions
|
@ -1,5 +1,5 @@
|
|||
/* 7zArcIn.c -- 7z Input functions
|
||||
2016-03-31 : Igor Pavlov : Public domain */
|
||||
2016-05-16 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
|
@ -1100,13 +1100,11 @@ static SRes SzReadHeader2(
|
|||
ISzAlloc *allocTemp
|
||||
)
|
||||
{
|
||||
UInt64 type;
|
||||
UInt32 numFiles = 0;
|
||||
UInt32 numEmptyStreams = 0;
|
||||
CSubStreamInfo ssi;
|
||||
const Byte *emptyStreams = NULL;
|
||||
const Byte *emptyFiles = NULL;
|
||||
|
||||
{
|
||||
UInt64 type;
|
||||
|
||||
SzData_Clear(&ssi.sdSizes);
|
||||
SzData_Clear(&ssi.sdCRCs);
|
||||
SzData_Clear(&ssi.sdNumSubStreams);
|
||||
|
@ -1120,9 +1118,9 @@ static SRes SzReadHeader2(
|
|||
{
|
||||
for (;;)
|
||||
{
|
||||
UInt64 type;
|
||||
RINOK(ReadID(sd, &type));
|
||||
if (type == k7zIdEnd)
|
||||
UInt64 type2;
|
||||
RINOK(ReadID(sd, &type2));
|
||||
if (type2 == k7zIdEnd)
|
||||
break;
|
||||
RINOK(SkipData(sd));
|
||||
}
|
||||
|
@ -1160,6 +1158,13 @@ static SRes SzReadHeader2(
|
|||
|
||||
if (type != k7zIdFilesInfo)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
}
|
||||
|
||||
{
|
||||
UInt32 numFiles = 0;
|
||||
UInt32 numEmptyStreams = 0;
|
||||
const Byte *emptyStreams = NULL;
|
||||
const Byte *emptyFiles = NULL;
|
||||
|
||||
RINOK(SzReadNumber32(sd, &numFiles));
|
||||
p->NumFiles = numFiles;
|
||||
|
@ -1458,7 +1463,7 @@ static SRes SzReadHeader2(
|
|||
if (ssi.sdNumSubStreams.Data && ssi.sdNumSubStreams.Size != 0)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
}
|
||||
|
||||
}
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#define MY_VER_MAJOR 16
|
||||
#define MY_VER_MINOR 02
|
||||
#define MY_VER_MINOR 04
|
||||
#define MY_VER_BUILD 0
|
||||
#define MY_VERSION_NUMBERS "16.02"
|
||||
#define MY_VERSION "16.02"
|
||||
#define MY_DATE "2016-05-21"
|
||||
#define MY_VERSION_NUMBERS "16.04"
|
||||
#define MY_VERSION "16.04"
|
||||
#define MY_DATE "2016-10-04"
|
||||
#undef MY_COPYRIGHT
|
||||
#undef MY_VERSION_COPYRIGHT_DATE
|
||||
#define MY_AUTHOR_NAME "Igor Pavlov"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Aes.c -- AES encryption / decryption
|
||||
2015-02-23 : Igor Pavlov : Public domain */
|
||||
2016-05-21 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
|
@ -167,10 +167,10 @@ void MY_FAST_CALL Aes_SetKey_Dec(UInt32 *w, const Byte *key, unsigned keySize)
|
|||
{
|
||||
UInt32 r = w[i];
|
||||
w[i] =
|
||||
D[ Sbox[gb0(r)]] ^
|
||||
D[0x100 + Sbox[gb1(r)]] ^
|
||||
D[0x200 + Sbox[gb2(r)]] ^
|
||||
D[0x300 + Sbox[gb3(r)]];
|
||||
D[ (unsigned)Sbox[gb0(r)]] ^
|
||||
D[0x100 + (unsigned)Sbox[gb1(r)]] ^
|
||||
D[0x200 + (unsigned)Sbox[gb2(r)]] ^
|
||||
D[0x300 + (unsigned)Sbox[gb3(r)]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* CpuArch.h -- CPU specific code
|
||||
2015-12-01: Igor Pavlov : Public domain */
|
||||
2016-06-09: Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __CPU_ARCH_H
|
||||
#define __CPU_ARCH_H
|
||||
|
@ -66,6 +66,7 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
|||
|| defined(__MIPSEL__) \
|
||||
|| defined(__MIPSEL) \
|
||||
|| defined(_MIPSEL) \
|
||||
|| defined(__BFIN__) \
|
||||
|| (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
|
||||
#define MY_CPU_LE
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder
|
||||
2015-11-08 : Igor Pavlov : Public domain */
|
||||
2016-05-16 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
|
@ -9,9 +9,6 @@
|
|||
#include "Bra.h"
|
||||
#include "LzmaDec.h"
|
||||
|
||||
static void *SzAlloc(void *p, size_t size) { UNUSED_VAR(p); return MyAlloc(size); }
|
||||
static void SzFree(void *p, void *address) { UNUSED_VAR(p); MyFree(address); }
|
||||
|
||||
SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -25,7 +22,6 @@ SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize)
|
|||
|
||||
SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen)
|
||||
{
|
||||
ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||
SRes res;
|
||||
int useFilter;
|
||||
SizeT inSizePure;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder
|
||||
2015-11-08 : Igor Pavlov : Public domain */
|
||||
2016-05-16 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
|
@ -13,13 +13,9 @@
|
|||
|
||||
#define SZE_OUT_OVERFLOW SZE_DATA_ERROR
|
||||
|
||||
static void *SzAlloc(void *p, size_t size) { UNUSED_VAR(p); return MyAlloc(size); }
|
||||
static void SzFree(void *p, void *address) { UNUSED_VAR(p); MyFree(address); }
|
||||
|
||||
int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
int level, UInt32 dictSize, int filterMode)
|
||||
{
|
||||
ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||
size_t outSize2 = *destLen;
|
||||
Byte *filteredStream;
|
||||
Bool useFilter;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* LzmaDec.c -- LZMA Decoder
|
||||
2015-06-23 : Igor Pavlov : Public domain */
|
||||
2016-05-16 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
|
@ -294,14 +294,14 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||
|
||||
#ifdef _LZMA_SIZE_OPT
|
||||
{
|
||||
unsigned limit, offset;
|
||||
unsigned lim, offset;
|
||||
CLzmaProb *probLen = prob + LenChoice;
|
||||
IF_BIT_0(probLen)
|
||||
{
|
||||
UPDATE_0(probLen);
|
||||
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
||||
offset = 0;
|
||||
limit = (1 << kLenNumLowBits);
|
||||
lim = (1 << kLenNumLowBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -312,17 +312,17 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||
UPDATE_0(probLen);
|
||||
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
||||
offset = kLenNumLowSymbols;
|
||||
limit = (1 << kLenNumMidBits);
|
||||
lim = (1 << kLenNumMidBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
UPDATE_1(probLen);
|
||||
probLen = prob + LenHigh;
|
||||
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
||||
limit = (1 << kLenNumHighBits);
|
||||
lim = (1 << kLenNumHighBits);
|
||||
}
|
||||
}
|
||||
TREE_DECODE(probLen, limit, len);
|
||||
TREE_DECODE(probLen, lim, len);
|
||||
len += offset;
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* LzmaEnc.c -- LZMA Encoder
|
||||
2015-11-08 : Igor Pavlov : Public domain */
|
||||
2016-05-16 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
|
@ -110,7 +110,7 @@ UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
|
|||
|
||||
#define kDicLogSizeMaxCompress 32
|
||||
|
||||
#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
|
||||
#define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); res = (zz + zz) + ((pos >> (zz - 1)) & 1); }
|
||||
|
||||
static UInt32 GetPosSlot1(UInt32 pos)
|
||||
{
|
||||
|
@ -147,19 +147,19 @@ static void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
|||
|
||||
/* we can use ((limit - pos) >> 31) only if (pos < ((UInt32)1 << 31)) */
|
||||
/*
|
||||
#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \
|
||||
#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \
|
||||
(0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
|
||||
res = p->g_FastPos[pos >> i] + (i * 2); }
|
||||
res = p->g_FastPos[pos >> zz] + (zz * 2); }
|
||||
*/
|
||||
|
||||
/*
|
||||
#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \
|
||||
#define BSR2_RET(pos, res) { UInt32 zz = 6 + ((kNumLogBits - 1) & \
|
||||
(0 - (((((UInt32)1 << (kNumLogBits)) - 1) - (pos >> 6)) >> 31))); \
|
||||
res = p->g_FastPos[pos >> i] + (i * 2); }
|
||||
res = p->g_FastPos[pos >> zz] + (zz * 2); }
|
||||
*/
|
||||
|
||||
#define BSR2_RET(pos, res) { UInt32 i = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \
|
||||
res = p->g_FastPos[pos >> i] + (i * 2); }
|
||||
#define BSR2_RET(pos, res) { UInt32 zz = (pos < (1 << (kNumLogBits + 6))) ? 6 : 6 + kNumLogBits - 1; \
|
||||
res = p->g_FastPos[pos >> zz] + (zz * 2); }
|
||||
|
||||
/*
|
||||
#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
|
||||
|
@ -985,12 +985,17 @@ static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
|
|||
|
||||
static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
{
|
||||
UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur;
|
||||
UInt32 matchPrice, repMatchPrice, normalMatchPrice;
|
||||
UInt32 lenEnd, cur;
|
||||
UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS];
|
||||
UInt32 *matches;
|
||||
|
||||
{
|
||||
|
||||
UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, len;
|
||||
UInt32 matchPrice, repMatchPrice, normalMatchPrice;
|
||||
const Byte *data;
|
||||
Byte curByte, matchByte;
|
||||
|
||||
if (p->optimumEndIndex != p->optimumCurrentIndex)
|
||||
{
|
||||
const COptimal *opt = &p->opt[p->optimumCurrentIndex];
|
||||
|
@ -1178,8 +1183,11 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
UInt32 numAvail;
|
||||
UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen;
|
||||
UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice;
|
||||
Bool nextIsChar;
|
||||
|
@ -1467,6 +1475,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||
for (lenTest = /*2*/ startLen; ; lenTest++)
|
||||
{
|
||||
UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
|
||||
{
|
||||
UInt32 lenToPosState = GetLenToPosState(lenTest);
|
||||
COptimal *opt;
|
||||
if (curBack < kNumFullDistances)
|
||||
|
@ -1482,6 +1491,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||
opt->backPrev = curBack + LZMA_NUM_REPS;
|
||||
opt->prev1IsChar = False;
|
||||
}
|
||||
}
|
||||
|
||||
if (/*_maxMode && */lenTest == matches[offs])
|
||||
{
|
||||
|
@ -1511,15 +1521,15 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||
/* for (; lenTest2 >= 2; lenTest2--) */
|
||||
{
|
||||
UInt32 offset = cur + lenTest + 1 + lenTest2;
|
||||
UInt32 curAndLenPrice;
|
||||
UInt32 curAndLenPrice2;
|
||||
COptimal *opt;
|
||||
while (lenEnd < offset)
|
||||
p->opt[++lenEnd].price = kInfinityPrice;
|
||||
curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
|
||||
curAndLenPrice2 = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
|
||||
opt = &p->opt[offset];
|
||||
if (curAndLenPrice < opt->price)
|
||||
if (curAndLenPrice2 < opt->price)
|
||||
{
|
||||
opt->price = curAndLenPrice;
|
||||
opt->price = curAndLenPrice2;
|
||||
opt->posPrev = cur + lenTest + 1;
|
||||
opt->backPrev = 0;
|
||||
opt->prev1IsChar = True;
|
||||
|
@ -1720,7 +1730,6 @@ static void FillDistancesPrices(CLzmaEnc *p)
|
|||
|
||||
{
|
||||
UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
|
||||
UInt32 i;
|
||||
for (i = 0; i < kStartPosModelIndex; i++)
|
||||
distancesPrices[i] = posSlotPrices[i];
|
||||
for (; i < kNumFullDistances; i++)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Ppmd7.c -- PPMdH codec
|
||||
2015-09-28 : Igor Pavlov : Public domain
|
||||
2016-05-21 : Igor Pavlov : Public domain
|
||||
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
@ -639,10 +639,10 @@ CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *escFreq)
|
|||
unsigned nonMasked = p->MinContext->NumStats - numMasked;
|
||||
if (p->MinContext->NumStats != 256)
|
||||
{
|
||||
see = p->See[p->NS2Indx[nonMasked - 1]] +
|
||||
see = p->See[(unsigned)p->NS2Indx[nonMasked - 1]] +
|
||||
(nonMasked < (unsigned)SUFFIX(p->MinContext)->NumStats - p->MinContext->NumStats) +
|
||||
2 * (p->MinContext->SummFreq < 11 * p->MinContext->NumStats) +
|
||||
4 * (numMasked > nonMasked) +
|
||||
2 * (unsigned)(p->MinContext->SummFreq < 11 * p->MinContext->NumStats) +
|
||||
4 * (unsigned)(numMasked > nonMasked) +
|
||||
p->HiBitsFlag;
|
||||
{
|
||||
unsigned r = (see->Summ >> see->Shift);
|
||||
|
|
Loading…
Reference in a new issue