Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

misc/internal/lzfP.h

00001 /*
00002  * Copyright (c) 2000 Marc Alexander Lehmann <pcg@goof.com>
00003  * 
00004  * Redistribution and use in source and binary forms, with or without modifica-
00005  * tion, are permitted provided that the following conditions are met:
00006  * 
00007  *   1.  Redistributions of source code must retain the above copyright notice,
00008  *       this list of conditions and the following disclaimer.
00009  * 
00010  *   2.  Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  * 
00014  *   3.  The name of the author may not be used to endorse or promote products
00015  *       derived from this software without specific prior written permission.
00016  * 
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00018  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
00019  * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
00020  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
00021  * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00022  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00023  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00024  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
00025  * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00026  * OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 #ifndef LZFP_h
00030 #define LZFP_h
00031 
00032 #define STANDALONE /* at the moment, this is ok. */
00033 
00034 #ifndef STANDALONE
00035 # include "lzf.h"
00036 #endif
00037 
00038 /*
00039  * size of hashtable is (1 << HLOG) * sizeof (char *)
00040  * decompression is independent of the hash table size
00041  * the difference between 15 and 14 is very small
00042  * for small blocks (and 14 is also faster).
00043  * For a low-memory configuration, use HLOG == 13;
00044  * For best compression, use 15 or 16.
00045  */
00046 #ifndef HLOG
00047 # define HLOG 16
00048 #endif
00049 
00050 /*
00051  * sacrifice some compression quality in favour of speed.
00052  * (roughly 1-2% worse compression for large blocks and
00053  * 9-10% for small, redundant, blocks and 20% better speed in both cases)
00054  * In short: enable this for binary data, disable this for text data.
00055  */
00056 #ifndef ULTRA_FAST
00057 # define ULTRA_FAST 0
00058 #endif
00059 
00060 /*
00061  * unconditionally aligning does not cost very much, so do it if unsure
00062  */
00063 #ifndef STRICT_ALIGN
00064 # define STRICT_ALIGN !defined(__i386)
00065 #endif
00066 
00067 /*
00068  * use string functions to copy memory.
00069  * this is usually a loss, even with glibc's optimized memcpy
00070  */
00071 #ifndef USE_MEMCPY
00072 # define USE_MEMCPY 1
00073 #endif
00074 
00075 /*
00076  * you may choose to pre-set the hash table (might be faster on modern cpus
00077  * and large (>>64k) blocks)
00078  */
00079 #ifndef INIT_HTAB
00080 # define INIT_HTAB 0
00081 #endif
00082 
00083 /*****************************************************************************/
00084 /* nothing should be changed below */
00085 
00086 typedef unsigned char u8;
00087 
00088 #if !STRICT_ALIGN
00089 /* for unaligned accesses we need a 16 bit datatype. */
00090 # include <limits.h>
00091 # if USHRT_MAX == 65535
00092     typedef unsigned short u16;
00093 # elif UINT_MAX == 65535
00094     typedef unsigned int u16;
00095 # else
00096 #  warn need 16 bit datatype when STRICT_ALIGN == 0
00097 #  undef STRICT_ALIGN
00098 #  define STRICT_ALIGN 1
00099 # endif
00100 #endif
00101 
00102 #if USE_MEMCPY || INIT_HTAB
00103 # include <string.h>
00104 #endif
00105 
00106 #endif
00107 

Generated on Tue Nov 5 11:11:05 2002 for GLT by doxygen1.2.18