Re: LZF Cryptoapi support.

From: Pavel Machek
Date: Tue Jul 19 2005 - 09:00:00 EST


Hi!

> Here's another resend, this time adding an lzf cryptoapi module.
>
> LZF is a very fast compressor which typically achieves approximately 50%
> compression on a suspend image. The original author (Marc Alexander
> Lehmann) donated it to Suspend2. I have converted it to cryptoapi with a
> recent switch of Suspend2 to use cryptoapi.

And it is still that old, ugly code.

> +/*
> + * sacrifice some compression quality in favour of compression speed.
> + * (roughly 1-2% worse compression for large blocks and
> + * 9-10% for small, redundant, blocks and >>20% better speed in both cases)
> + * In short: enable this for binary data, disable this for text data.
> + */
> +#define ULTRA_FAST 1
> +
> +#define STRICT_ALIGN 0
> +#define USE_MEMCPY 1
> +#define INIT_HTAB 0

We do not want these options. It also allows you to kill ifdefs down
in the code.

> +#define HSIZE (1 << (HLOG))
> +
> +/*
> + * don't play with this unless you benchmark!
> + * decompression is not dependent on the hash function
> + * the hashing function might seem strange, just believe me
> + * it works ;)
> + */
> +#define FRST(p) (((p[0]) << 8) + p[1])
> +#define NEXT(v,p) (((v) << 8) + p[2])
> +#define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) + h*3) & (HSIZE - 1))
> +/*
> + * IDX works because it is very similar to a multiplicative hash, e.g.
> + * (h * 57321 >> (3*8 - HLOG))
> + * the next one is also quite good, albeit slow ;)
> + * (int)(cos(h & 0xffffff) * 1e6)
> + */
> +
> +#if 0
> +/* original lzv-like hash function */
> +# define FRST(p) (p[0] << 5) ^ p[1]
> +# define NEXT(v,p) ((v) << 5) ^ p[2]
> +# define IDX(h) ((h) & (HSIZE - 1))
> +#endif

And we do not want #if 0-ed code.

Pavel
--
teflon -- maybe it is a trademark, but it should not be.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/