1 /**********************************************************************
2   Copyright(c) 2011-2016 Intel Corporation All rights reserved.
3 
4   Redistribution and use in source and binary forms, with or without
5   modification, are permitted provided that the following conditions
6   are met:
7     * Redistributions of source code must retain the above copyright
8       notice, this list of conditions and the following disclaimer.
9     * Redistributions in binary form must reproduce the above copyright
10       notice, this list of conditions and the following disclaimer in
11       the documentation and/or other materials provided with the
12       distribution.
13     * Neither the name of Intel Corporation nor the names of its
14       contributors may be used to endorse or promote products derived
15       from this software without specific prior written permission.
16 
17   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 **********************************************************************/
29 #ifndef _IGZIP_REPEATED_8K_CHAR_RESULT_H_
30 #define _IGZIP_REPEATED_8K_CHAR_RESULT_H_
31 
32 /* The code for the literal being encoded */
33 #define CODE_LIT 0x1
34 #define CODE_LIT_LENGTH 0x2
35 
36 /* The code for repeat 10. The Length includes the distance code length*/
37 #define CODE_10  0x3
38 #define CODE_10_LENGTH  0x4
39 
40 /* The code for repeat 115-130. The Length includes the distance code length*/
41 #define CODE_280 0x0f
42 #define CODE_280_LENGTH 0x4
43 #define CODE_280_TOTAL_LENGTH CODE_280_LENGTH + 4 + 1
44 
45 /* Code representing the end of block. */
46 #define END_OF_BLOCK 0x7
47 #define END_OF_BLOCK_LEN 0x4
48 
49 /* MIN_REPEAT_LEN currently optimizes storage space, another possiblity is to
50  * find the size which optimizes speed instead.*/
51 #define MIN_REPEAT_LEN 4*1024
52 
53 #define HEADER_LENGTH 16
54 
55 /* Maximum length of the portion of the header represented by repeat lengths
56  * smaller than 258 */
57 #define MAX_FIXUP_CODE_LENGTH 8
58 
59 
60 /* Headers for constant 0x00 and 0xFF blocks
61  * This also contains the first literal character. */
62 const uint32_t repeated_char_header[2][5] = {
63 	{ 0x0121c0ec, 0xc30c0000, 0x7d57fab0, 0x49270938}, /* Deflate header for 0x00 */
64 	{ 0x0121c0ec, 0xc30c0000, 0x7baaff30, 0x49270938}  /* Deflate header for 0xFF */
65 
66 };
67 
68 #endif /*_IGZIP_REPEATED_8K_CHAR_RESULT_H_*/
69