"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fast_encoder.h" between
lzlib-1.11.tar.lz and lzlib-1.12-rc1.tar.lz

About: Lzlib is a data compression library providing in-memory LZMA compression and decompression functions using the lzip format. Release candidate.

fast_encoder.h  (lzlib-1.11.tar.lz):fast_encoder.h  (lzlib-1.12-rc1.tar.lz)
/* Lzlib - Compression library for the lzip format /* Lzlib - Compression library for the lzip format
Copyright (C) 2009-2019 Antonio Diaz Diaz. Copyright (C) 2009-2020 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided
that the following conditions are met: that the following conditions are met:
1. Redistributions of source code must retain the above copyright 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright 2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/ */
struct FLZ_encoder struct FLZ_encoder
{ {
struct LZ_encoder_base eb; struct LZ_encoder_base eb;
unsigned key4; /* key made from latest 4 bytes */ unsigned key4; /* key made from latest 4 bytes */
}; };
static inline void FLZe_reset_key4( struct FLZ_encoder * const fe ) static inline void FLZe_reset_key4( struct FLZ_encoder * const fe )
{ {
int i; int i;
fe->key4 = 0; fe->key4 = 0;
for( i = 0; i < 3 && i < Mb_available_bytes( &fe->eb.mb ); ++i ) for( i = 0; i < 3 && i < Mb_available_bytes( &fe->eb.mb ); ++i )
fe->key4 = ( fe->key4 << 4 ) ^ fe->eb.mb.buffer[i]; fe->key4 = ( fe->key4 << 4 ) ^ fe->eb.mb.buffer[i];
} }
int FLZe_longest_match_len( struct FLZ_encoder * const fe, int * const distance ); int FLZe_longest_match_len( struct FLZ_encoder * const fe, int * const distance );
static inline bool FLZe_update_and_move( struct FLZ_encoder * const fe, int n ) static inline bool FLZe_update_and_move( struct FLZ_encoder * const fe, int n )
{ {
struct Matchfinder_base * const mb = &fe->eb.mb;
while( --n >= 0 ) while( --n >= 0 )
{ {
if( Mb_available_bytes( &fe->eb.mb ) >= 4 ) if( Mb_available_bytes( mb ) >= 4 )
{ {
fe->key4 = ( ( fe->key4 << 4 ) ^ fe->eb.mb.buffer[fe->eb.mb.pos+3] ) & fe->key4 = ( ( fe->key4 << 4 ) ^ mb->buffer[mb->pos+3] ) & mb->key4_mask;
fe->eb.mb.key4_mask; mb->pos_array[mb->cyclic_pos] = mb->prev_positions[fe->key4];
fe->eb.mb.pos_array[fe->eb.mb.cyclic_pos] = fe->eb.mb.prev_positions[fe->k mb->prev_positions[fe->key4] = mb->pos + 1;
ey4];
fe->eb.mb.prev_positions[fe->key4] = fe->eb.mb.pos + 1;
} }
else fe->eb.mb.pos_array[fe->eb.mb.cyclic_pos] = 0; else mb->pos_array[mb->cyclic_pos] = 0;
if( !Mb_move_pos( &fe->eb.mb ) ) return false; if( !Mb_move_pos( mb ) ) return false;
} }
return true; return true;
} }
static inline bool FLZe_init( struct FLZ_encoder * const fe, static inline bool FLZe_init( struct FLZ_encoder * const fe,
const unsigned long long member_size ) const unsigned long long member_size )
{ {
enum { before_size = 0, enum { before_size = 0,
dict_size = 65536, dict_size = 65536,
/* bytes to keep in buffer after pos */ /* bytes to keep in buffer after pos */
 End of changes. 6 change blocks. 
24 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)