From 2bdc2226d245a24c948c4c98364d7da2adc6c860 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 21 Feb 2022 13:11:58 +0100 Subject: Adding upstream version 1.23. Signed-off-by: Daniel Baumann --- lzip.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lzip.h') diff --git a/lzip.h b/lzip.h index 3623e81..186501c 100644 --- a/lzip.h +++ b/lzip.h @@ -1,5 +1,5 @@ /* Lzip - LZMA lossless data compressor - Copyright (C) 2008-2021 Antonio Diaz Diaz. + Copyright (C) 2008-2022 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 @@ -30,11 +30,7 @@ public: static const int next[states] = { 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5 }; st = next[st]; } - bool is_char_set_char() - { - if( st < 7 ) { st -= ( st < 4 ) ? st : 3; return true; } - else { st -= ( st < 10 ) ? 3 : 6; return false; } - } + bool is_char_set_char() { set_char(); return st < 4; } void set_char_rep() { st = 8; } void set_match() { st = ( st < 7 ) ? 7 : 10; } void set_rep() { st = ( st < 7 ) ? 8 : 11; } @@ -176,6 +172,7 @@ public: void update_byte( uint32_t & crc, const uint8_t byte ) const { crc = data[(crc^byte)&0xFF] ^ ( crc >> 8 ); } + // about as fast as it is possible without messing with endianness void update_buf( uint32_t & crc, const uint8_t * const buffer, const int size ) const { @@ -221,6 +218,7 @@ struct Lzip_header if( data[i] != lzip_magic[i] ) return false; return ( sz > 0 ); } + bool verify_corrupt() const // detect corrupt header { int matches = 0; -- cgit v1.2.3