1
0
Fork 0

Merging upstream version 1.25~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-21 11:33:25 +01:00
parent 1d67e88e3c
commit b8e73cb85f
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
39 changed files with 978 additions and 742 deletions

View file

@ -53,12 +53,15 @@ public:
return p;
}
void load()
bool load()
{
code = 0;
range = 0xFFFFFFFFU;
// check first byte of the LZMA stream without reading it
if( buffer[pos] != 0 ) return false;
get_byte(); // discard first byte of the LZMA stream
for( int i = 0; i < 4; ++i ) code = ( code << 8 ) | get_byte();
return true;
}
void normalize()
@ -76,7 +79,7 @@ public:
range >>= 1;
// symbol <<= 1;
// if( code >= range ) { code -= range; symbol |= 1; }
const bool bit = ( code >= range );
const bool bit = code >= range;
symbol <<= 1; symbol += bit;
code -= range & ( 0U - bit );
}
@ -299,14 +302,14 @@ class LZ_mtester
bool fast, fast2;
if( lpos > distance )
{
fast = ( len < dictionary_size - lpos );
fast2 = ( fast && len <= lpos - i );
fast = len < dictionary_size - lpos;
fast2 = fast && len <= lpos - i;
}
else
{
i += dictionary_size;
fast = ( len < dictionary_size - i ); // (i == pos) may happen
fast2 = ( fast && len <= i - lpos );
fast = len < dictionary_size - i; // (i == pos) may happen
fast2 = fast && len <= i - lpos;
}
if( fast ) // no wrap
{
@ -378,8 +381,8 @@ public:
const uint8_t * get_buffers( const uint8_t ** const prev_bufferp,
int * const sizep, int * const prev_sizep ) const
{ *sizep = ( pos_wrapped && pos == 0 ) ? dictionary_size : pos;
*prev_sizep = ( pos_wrapped && pos > 0 ) ? dictionary_size - pos : 0;
{ *sizep = (pos_wrapped && pos == 0) ? dictionary_size : pos;
*prev_sizep = (pos_wrapped && pos > 0) ? dictionary_size - pos : 0;
*prev_bufferp = buffer + pos; return buffer; }
void duplicate_buffer( uint8_t * const buffer2 );