… | |
… | |
92 | #endif |
92 | #endif |
93 | |
93 | |
94 | /* |
94 | /* |
95 | * Avoid assigning values to errno variable? for some embedding purposes |
95 | * Avoid assigning values to errno variable? for some embedding purposes |
96 | * (linux kernel for example), this is necessary. NOTE: this breaks |
96 | * (linux kernel for example), this is necessary. NOTE: this breaks |
97 | * the documentation in lzf.h. |
97 | * the documentation in lzf.h. Avoiding errno has no speed impact. |
98 | */ |
98 | */ |
99 | #ifndef AVOID_ERRNO |
99 | #ifndef AVOID_ERRNO |
100 | # define AVOID_ERRNO 0 |
100 | # define AVOID_ERRNO 0 |
101 | #endif |
101 | #endif |
102 | |
102 | |
… | |
… | |
122 | #endif |
122 | #endif |
123 | |
123 | |
124 | /*****************************************************************************/ |
124 | /*****************************************************************************/ |
125 | /* nothing should be changed below */ |
125 | /* nothing should be changed below */ |
126 | |
126 | |
|
|
127 | #ifdef __cplusplus |
|
|
128 | # include <cstring> |
|
|
129 | using namespace std; |
|
|
130 | #else |
|
|
131 | # include <string.h> |
|
|
132 | #endif |
|
|
133 | |
127 | typedef unsigned char u8; |
134 | typedef unsigned char u8; |
128 | |
135 | |
129 | typedef const u8 *LZF_STATE[1 << (HLOG)]; |
136 | typedef const u8 *LZF_STATE[1 << (HLOG)]; |
130 | |
137 | |
131 | #if !STRICT_ALIGN |
138 | #if !STRICT_ALIGN |
132 | /* for unaligned accesses we need a 16 bit datatype. */ |
139 | /* for unaligned accesses we need a 16 bit datatype. */ |
|
|
140 | # ifdef __cplusplus |
|
|
141 | # include <climits> |
|
|
142 | # else |
133 | # include <limits.h> |
143 | # include <limits.h> |
|
|
144 | # endif |
134 | # if USHRT_MAX == 65535 |
145 | # if USHRT_MAX == 65535 |
135 | typedef unsigned short u16; |
146 | typedef unsigned short u16; |
136 | # elif UINT_MAX == 65535 |
147 | # elif UINT_MAX == 65535 |
137 | typedef unsigned int u16; |
148 | typedef unsigned int u16; |
138 | # else |
149 | # else |
… | |
… | |
140 | # define STRICT_ALIGN 1 |
151 | # define STRICT_ALIGN 1 |
141 | # endif |
152 | # endif |
142 | #endif |
153 | #endif |
143 | |
154 | |
144 | #if ULTRA_FAST |
155 | #if ULTRA_FAST |
145 | # if defined(VERY_FAST) |
|
|
146 | # undef VERY_FAST |
156 | # undef VERY_FAST |
147 | # endif |
|
|
148 | #endif |
|
|
149 | |
|
|
150 | #if INIT_HTAB |
|
|
151 | # ifdef __cplusplus |
|
|
152 | # include <cstring> |
|
|
153 | # else |
|
|
154 | # include <string.h> |
|
|
155 | # endif |
|
|
156 | #endif |
157 | #endif |
157 | |
158 | |
158 | #endif |
159 | #endif |
159 | |
160 | |