diff options
Diffstat (limited to 'fast_encoder.h')
-rw-r--r-- | fast_encoder.h | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/fast_encoder.h b/fast_encoder.h index 6066b85..1c3a6ff 100644 --- a/fast_encoder.h +++ b/fast_encoder.h @@ -1,20 +1,20 @@ -/* Lzlib - Compression library for the lzip format - Copyright (C) 2009-2019 Antonio Diaz Diaz. +/* Lzlib - Compression library for the lzip format + Copyright (C) 2009-2021 Antonio Diaz Diaz. - This library is free software. Redistribution and use in source and - binary forms, with or without modification, are permitted provided - that the following conditions are met: + This library is free software. Redistribution and use in source and + binary forms, with or without modification, are permitted provided + that the following conditions are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ struct FLZ_encoder @@ -31,21 +31,19 @@ static inline void FLZe_reset_key4( struct FLZ_encoder * const fe ) fe->key4 = ( fe->key4 << 4 ) ^ fe->eb.mb.buffer[i]; } -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 ) { + struct Matchfinder_base * const mb = &fe->eb.mb; 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->eb.mb.key4_mask; - fe->eb.mb.pos_array[fe->eb.mb.cyclic_pos] = fe->eb.mb.prev_positions[fe->key4]; - fe->eb.mb.prev_positions[fe->key4] = fe->eb.mb.pos + 1; + fe->key4 = ( ( fe->key4 << 4 ) ^ mb->buffer[mb->pos+3] ) & mb->key4_mask; + mb->pos_array[mb->cyclic_pos] = mb->prev_positions[fe->key4]; + mb->prev_positions[fe->key4] = mb->pos + 1; } - else fe->eb.mb.pos_array[fe->eb.mb.cyclic_pos] = 0; - if( !Mb_move_pos( &fe->eb.mb ) ) return false; + else mb->pos_array[mb->cyclic_pos] = 0; + if( !Mb_move_pos( mb ) ) return false; } return true; } |