31 #define OUTBUF_PADDED 1
33 #define INBUF_PADDED 1
54 #define GETB(c) (*(c).in++)
56 #define GETB(c) get_byte(&(c))
70 if (cnt >= INT_MAX - 1000) {
90 if (cnt > c->
in_end - src) {
98 #if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
105 memcpy(dst, src, cnt);
139 if (*outlen <= 0 || *inlen <= 0) {
166 back = (
GETB(c) << 3) + ((x >> 2) & 7) + 1;
170 back = (
GETB(c) << 6) + (x >> 2) + 1;
173 back = (1 << 14) + ((x & 8) << 11);
175 back += (
GETB(c) << 6) + (x >> 2);
176 if (back == (1 << 14)) {
189 back = (1 << 11) + (
GETB(c) << 2) + (x >> 2) + 1;
192 back = (
GETB(c) << 2) + (x >> 2) + 1;
209 #include <lzo/lzo1x.h>
211 #define MAXSZ (10*1024*1024)
215 #define BENCHMARK_LIBLZO_SAFE 0
216 #define BENCHMARK_LIBLZO_UNSAFE 0
218 int main(
int argc,
char *argv[]) {
219 FILE *
in = fopen(argv[1],
"rb");
223 size_t s = fread(orig, 1, MAXSZ, in);
225 long tmp[LZO1X_MEM_COMPRESS];
229 lzo1x_999_compress(orig, s, comp, &clen, tmp);
230 for (i = 0; i < 300; i++) {
232 inlen = clen; outlen = MAXSZ;
233 #if BENCHMARK_LIBLZO_SAFE
234 if (lzo1x_decompress_safe(comp, inlen, decomp, &outlen,
NULL))
235 #elif BENCHMARK_LIBLZO_UNSAFE
236 if (lzo1x_decompress(comp, inlen, decomp, &outlen,
NULL))
243 if (memcmp(orig, decomp, s))