ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/liblzf/lzfP.h
(Generate patch)

Comparing liblzf/lzfP.h (file contents):
Revision 1.11 by root, Tue Mar 8 19:59:52 2005 UTC vs.
Revision 1.15 by root, Thu Jun 21 22:11:34 2007 UTC

44#ifndef STANDALONE 44#ifndef STANDALONE
45# include "lzf.h" 45# include "lzf.h"
46#endif 46#endif
47 47
48/* 48/*
49 * size of hashtable is (1 << HLOG) * sizeof (char *) 49 * Size of hashtable is (1 << HLOG) * sizeof (char *)
50 * decompression is independent of the hash table size 50 * decompression is independent of the hash table size
51 * the difference between 15 and 14 is very small 51 * the difference between 15 and 14 is very small
52 * for small blocks (and 14 is usually a but faster). 52 * for small blocks (and 14 is usually a bit faster).
53 * For a low-memory/faster configuration, use HLOG == 13; 53 * For a low-memory/faster configuration, use HLOG == 13;
54 * For best compression, use 15 or 16 (or more). 54 * For best compression, use 15 or 16 (or more).
55 */ 55 */
56#ifndef HLOG 56#ifndef HLOG
57# define HLOG 14 57# define HLOG 15
58#endif 58#endif
59 59
60/* 60/*
61 * sacrifice very little compression quality in favour of compression speed. 61 * Sacrifice very little compression quality in favour of compression speed.
62 * This gives almost the same compression as the default code, and is 62 * This gives almost the same compression as the default code, and is
63 * (very roughly) 15% faster. This is the preferable mode of operation. 63 * (very roughly) 15% faster. This is the preferable mode of operation.
64 */ 64 */
65 65
66#ifndef VERY_FAST 66#ifndef VERY_FAST
67# define VERY_FAST 1 67# define VERY_FAST 1
68#endif 68#endif
69 69
70/* 70/*
71 * sacrifice some more compression quality in favour of compression speed. 71 * Sacrifice some more compression quality in favour of compression speed.
72 * (roughly 1-2% worse compression for large blocks and 72 * (roughly 1-2% worse compression for large blocks and
73 * 9-10% for small, redundant, blocks and >>20% better speed in both cases) 73 * 9-10% for small, redundant, blocks and >>20% better speed in both cases)
74 * In short: when in need for speed, enable this for binary data, 74 * In short: when in need for speed, enable this for binary data,
75 * possibly disable this for text data. 75 * possibly disable this for text data.
76 */ 76 */
77#ifndef ULTRA_FAST 77#ifndef ULTRA_FAST
78# define ULTRA_FAST 0 78# define ULTRA_FAST 0
79#endif 79#endif
80 80
81/* 81/*
82 * unconditionally aligning does not cost very much, so do it if unsure 82 * Unconditionally aligning does not cost very much, so do it if unsure
83 */ 83 */
84#ifndef STRICT_ALIGN 84#ifndef STRICT_ALIGN
85# define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) 85# define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
86#endif 86#endif
87 87
88/* 88/*
89 * use string functions to copy memory.
90 * this is usually a loss, even with glibc's optimized memcpy
91 */
92#ifndef USE_MEMCPY
93# define USE_MEMCPY 0
94#endif
95
96/*
97 * you may choose to pre-set the hash table (might be faster on some 89 * You may choose to pre-set the hash table (might be faster on some
98 * modern cpus and large (>>64k) blocks) 90 * modern cpus and large (>>64k) blocks, and also makes compression
91 * deterministic/repeatable when the configuration otherwise is the same).
99 */ 92 */
100#ifndef INIT_HTAB 93#ifndef INIT_HTAB
101# define INIT_HTAB 0 94# define INIT_HTAB 0
102#endif 95#endif
103 96
104/* 97/*
105 * avoid assigning values to errno variable? for some embedding purposes 98 * Avoid assigning values to errno variable? for some embedding purposes
106 * (linux kernel for example), this is neccessary. NOTE: this breaks 99 * (linux kernel for example), this is neccessary. NOTE: this breaks
107 * the documentation in lzf.h. 100 * the documentation in lzf.h.
108 */ 101 */
109#ifndef AVOID_ERRNO 102#ifndef AVOID_ERRNO
110# define AVOID_ERRNO 0 103# define AVOID_ERRNO 0
115 * on the stack. For small-stack environments, define this to 1. 108 * on the stack. For small-stack environments, define this to 1.
116 * NOTE: this breaks the prototype in lzf.h. 109 * NOTE: this breaks the prototype in lzf.h.
117 */ 110 */
118#ifndef LZF_STATE_ARG 111#ifndef LZF_STATE_ARG
119# define LZF_STATE_ARG 0 112# define LZF_STATE_ARG 0
113#endif
114
115/*
116 * Wether to add extra checks for input validity in lzf_decompress
117 * and return EINVAL if the input stream has been corrupted. This
118 * only shields against overflowing the input buffer and will not
119 * detect most corrupted streams.
120 * This check is not normally noticable on modern hardware
121 * (<1% slowdown), but might slow down older cpus considerably.
122 */
123#ifndef CHECK_INPUT
124# define CHECK_INPUT 1
120#endif 125#endif
121 126
122/*****************************************************************************/ 127/*****************************************************************************/
123/* nothing should be changed below */ 128/* nothing should be changed below */
124 129
143# if defined(VERY_FAST) 148# if defined(VERY_FAST)
144# undef VERY_FAST 149# undef VERY_FAST
145# endif 150# endif
146#endif 151#endif
147 152
148#if USE_MEMCPY || INIT_HTAB 153#if INIT_HTAB
149# ifdef __cplusplus 154# ifdef __cplusplus
150# include <cstring> 155# include <cstring>
151# else 156# else
152# include <string.h> 157# include <string.h>
153# endif 158# endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines