1 | /* |
1 | /* |
2 | * Copyright (c) 2000 Marc Alexander Lehmann <pcg@goof.com> |
2 | * Copyright (c) 2000-2003 Marc Alexander Lehmann <pcg@goof.com> |
3 | * |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without modifica- |
4 | * Redistribution and use in source and binary forms, with or without modifica- |
5 | * tion, are permitted provided that the following conditions are met: |
5 | * tion, are permitted provided that the following conditions are met: |
6 | * |
6 | * |
7 | * 1. Redistributions of source code must retain the above copyright notice, |
7 | * 1. Redistributions of source code must retain the above copyright notice, |
… | |
… | |
48 | #endif |
48 | #endif |
49 | |
49 | |
50 | /* |
50 | /* |
51 | * sacrifice some compression quality in favour of compression speed. |
51 | * sacrifice some compression quality in favour of compression speed. |
52 | * (roughly 1-2% worse compression for large blocks and |
52 | * (roughly 1-2% worse compression for large blocks and |
53 | * 9-10% for small, redundant, blocks and 20% better speed in both cases) |
53 | * 9-10% for small, redundant, blocks and >>20% better speed in both cases) |
54 | * In short: enable this for binary data, disable this for text data. |
54 | * In short: enable this for binary data, disable this for text data. |
55 | */ |
55 | */ |
56 | #ifndef ULTRA_FAST |
56 | #ifndef ULTRA_FAST |
57 | # define ULTRA_FAST 1 |
57 | # define ULTRA_FAST 1 |
58 | #endif |
58 | #endif |
… | |
… | |
78 | */ |
78 | */ |
79 | #ifndef INIT_HTAB |
79 | #ifndef INIT_HTAB |
80 | # define INIT_HTAB 0 |
80 | # define INIT_HTAB 0 |
81 | #endif |
81 | #endif |
82 | |
82 | |
|
|
83 | /* |
|
|
84 | * avoid assigning values to errno variable? for some embedding purposes |
|
|
85 | * (linux kernel for example), this is neccessary. NOTE: this breaks |
|
|
86 | * the documentation in lzf.h. |
|
|
87 | */ |
|
|
88 | #ifndef AVOID_ERRNO |
|
|
89 | # define AVOID_ERRNO 0 |
|
|
90 | #endif |
|
|
91 | |
|
|
92 | /* |
|
|
93 | * Wether to pass the LZF_STATE variable as argument, or allocate it |
|
|
94 | * on the stack. For small-stack environments, define this to zero. |
|
|
95 | * NOTE: this breaks the prototype in lzf.h. |
|
|
96 | */ |
|
|
97 | #ifndef LZF_STATE_ARG |
|
|
98 | # define LZF_STATE_ARG 1 |
|
|
99 | #endif |
|
|
100 | |
83 | /*****************************************************************************/ |
101 | /*****************************************************************************/ |
84 | /* nothing should be changed below */ |
102 | /* nothing should be changed below */ |
85 | |
103 | |
86 | typedef unsigned char u8; |
104 | typedef unsigned char u8; |
|
|
105 | |
|
|
106 | typedef const u8 *LZF_STATE[1 << (HLOG)]; |
87 | |
107 | |
88 | #if !STRICT_ALIGN |
108 | #if !STRICT_ALIGN |
89 | /* for unaligned accesses we need a 16 bit datatype. */ |
109 | /* for unaligned accesses we need a 16 bit datatype. */ |
90 | # include <limits.h> |
110 | # include <limits.h> |
91 | # if USHRT_MAX == 65535 |
111 | # if USHRT_MAX == 65535 |
92 | typedef unsigned short u16; |
112 | typedef unsigned short u16; |
93 | # elif UINT_MAX == 65535 |
113 | # elif UINT_MAX == 65535 |
94 | typedef unsigned int u16; |
114 | typedef unsigned int u16; |
95 | # else |
115 | # else |
96 | # warn need 16 bit datatype when STRICT_ALIGN == 0, this is non-fatal |
|
|
97 | # undef STRICT_ALIGN |
116 | # undef STRICT_ALIGN |
98 | # define STRICT_ALIGN 1 |
117 | # define STRICT_ALIGN 1 |
99 | # endif |
118 | # endif |
100 | #endif |
119 | #endif |
101 | |
120 | |