From 819e0c36ebc8567836ec40be92c07b9a639cdbe3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 23 Jan 2024 15:39:04 +0100 Subject: Adding upstream version 1.14. Signed-off-by: Daniel Baumann --- encoder_base.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'encoder_base.h') diff --git a/encoder_base.h b/encoder_base.h index 17ffc93..094f679 100644 --- a/encoder_base.h +++ b/encoder_base.h @@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format - Copyright (C) 2009-2022 Antonio Diaz Diaz. + Copyright (C) 2009-2024 Antonio Diaz Diaz. This library is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided @@ -142,7 +142,7 @@ static inline int price1( const Bit_model probability ) { return get_price( bit_model_total - probability ); } static inline int price_bit( const Bit_model bm, const bool bit ) - { return ( bit ? price1( bm ) : price0( bm ) ); } + { return bit ? price1( bm ) : price0( bm ); } static inline int price_symbol3( const Bit_model bm[], int symbol ) @@ -276,8 +276,8 @@ static inline int Mb_free_bytes( const struct Matchfinder_base * const mb ) static inline bool Mb_enough_available_bytes( const struct Matchfinder_base * const mb ) - { return ( mb->pos + mb->after_size <= mb->stream_pos || - ( Mb_flushing_or_end( mb ) && mb->pos < mb->stream_pos ) ); } + { return mb->pos + mb->after_size <= mb->stream_pos || + ( Mb_flushing_or_end( mb ) && mb->pos < mb->stream_pos ); } static inline const uint8_t * Mb_ptr_to_current_pos( const struct Matchfinder_base * const mb ) @@ -340,7 +340,6 @@ static inline void Re_shift_low( struct Range_encoder * const renc ) static inline void Re_reset( struct Range_encoder * const renc, const unsigned dictionary_size ) { - int i; Cb_reset( &renc->cb ); renc->low = 0; renc->partial_member_pos = 0; @@ -348,8 +347,7 @@ static inline void Re_reset( struct Range_encoder * const renc, renc->ff_count = 0; renc->cache = 0; Lh_set_dictionary_size( renc->header, dictionary_size ); - for( i = 0; i < Lh_size; ++i ) - Cb_put_byte( &renc->cb, renc->header[i] ); + int i; for( i = 0; i < Lh_size; ++i ) Cb_put_byte( &renc->cb, renc->header[i] ); } static inline bool Re_init( struct Range_encoder * const renc, @@ -398,8 +396,7 @@ static inline void Re_encode( struct Range_encoder * const renc, { renc->range >>= 1; if( symbol & mask ) renc->low += renc->range; - if( renc->range <= 0x00FFFFFFU ) - { renc->range <<= 8; Re_shift_low( renc ); } + if( renc->range <= 0x00FFFFFFU ) { renc->range <<= 8; Re_shift_low( renc ); } } } @@ -559,7 +556,7 @@ static inline bool LZeb_init( struct LZ_encoder_base * const eb, } static inline bool LZeb_member_finished( const struct LZ_encoder_base * const eb ) - { return ( eb->member_finished && Cb_empty( &eb->renc.cb ) ); } + { return eb->member_finished && Cb_empty( &eb->renc.cb ); } static inline void LZeb_free( struct LZ_encoder_base * const eb ) { Re_free( &eb->renc ); Mb_free( &eb->mb ); } -- cgit v1.2.3