diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-01-25 13:46:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-01-25 13:46:42 +0000 |
commit | e74d15e54c99ce6d8210d28d68732ec61e924c72 (patch) | |
tree | ff66615c35389f6a1cbe1e0293bab664e0944219 /encoder_base.h | |
parent | Releasing debian version 1.21-8. (diff) | |
download | lzip-e74d15e54c99ce6d8210d28d68732ec61e924c72.tar.xz lzip-e74d15e54c99ce6d8210d28d68732ec61e924c72.zip |
Merging upstream version 1.22.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'encoder_base.h')
-rw-r--r-- | encoder_base.h | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/encoder_base.h b/encoder_base.h index 4c1962f..9d45565 100644 --- a/encoder_base.h +++ b/encoder_base.h @@ -1,18 +1,18 @@ -/* Lzip - LZMA lossless data compressor - Copyright (C) 2008-2019 Antonio Diaz Diaz. +/* Lzip - LZMA lossless data compressor + Copyright (C) 2008-2021 Antonio Diaz Diaz. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. - This program 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. See the - GNU General Public License for more details. + This program 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. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ enum { price_shift_bits = 6, @@ -137,7 +137,7 @@ inline int price_symbol_reversed( const Bit_model bm[], int symbol, const bool bit = symbol & 1; symbol >>= 1; price += price_bit( bm[model], bit ); - model = ( model << 1 ) | bit; + model <<= 1; model |= bit; } return price; } @@ -315,27 +315,27 @@ public: void encode_tree3( Bit_model bm[], const int symbol ) { - int model = 1; bool bit = ( symbol >> 2 ) & 1; - encode_bit( bm[model], bit ); model = ( model << 1 ) | bit; + encode_bit( bm[1], bit ); + int model = 2 | bit; bit = ( symbol >> 1 ) & 1; - encode_bit( bm[model], bit ); model = ( model << 1 ) | bit; + encode_bit( bm[model], bit ); model <<= 1; model |= bit; encode_bit( bm[model], symbol & 1 ); } void encode_tree6( Bit_model bm[], const unsigned symbol ) { - int model = 1; bool bit = ( symbol >> 5 ) & 1; - encode_bit( bm[model], bit ); model = ( model << 1 ) | bit; + encode_bit( bm[1], bit ); + int model = 2 | bit; bit = ( symbol >> 4 ) & 1; - encode_bit( bm[model], bit ); model = ( model << 1 ) | bit; + encode_bit( bm[model], bit ); model <<= 1; model |= bit; bit = ( symbol >> 3 ) & 1; - encode_bit( bm[model], bit ); model = ( model << 1 ) | bit; + encode_bit( bm[model], bit ); model <<= 1; model |= bit; bit = ( symbol >> 2 ) & 1; - encode_bit( bm[model], bit ); model = ( model << 1 ) | bit; + encode_bit( bm[model], bit ); model <<= 1; model |= bit; bit = ( symbol >> 1 ) & 1; - encode_bit( bm[model], bit ); model = ( model << 1 ) | bit; + encode_bit( bm[model], bit ); model <<= 1; model |= bit; encode_bit( bm[model], symbol & 1 ); } @@ -346,7 +346,7 @@ public: { const bool bit = ( symbol >> i ) & 1; encode_bit( bm[model], bit ); - model = ( model << 1 ) | bit; + model <<= 1; model |= bit; } } @@ -358,7 +358,7 @@ public: const bool bit = symbol & 1; symbol >>= 1; encode_bit( bm[model], bit ); - model = ( model << 1 ) | bit; + model <<= 1; model |= bit; } } @@ -460,8 +460,8 @@ protected: const unsigned direct_dis = dis - base; if( dis_slot < end_dis_model ) - renc.encode_tree_reversed( bm_dis + ( base - dis_slot ), direct_dis, - direct_bits ); + renc.encode_tree_reversed( bm_dis + ( base - dis_slot ), + direct_dis, direct_bits ); else { renc.encode( direct_dis >> dis_align_bits, direct_bits - dis_align_bits ); |