summaryrefslogtreecommitdiff
path: root/lzfP.h
diff options
context:
space:
mode:
authorroot <root>2010-06-01 03:17:05 +0000
committerroot <root>2010-06-01 03:17:05 +0000
commita59dc3c43c6be0f428788ad66988329f4d29e8dd (patch)
treea2be0f20a3e0ff30682b7e1770758c31c5ec6fbb /lzfP.h
parent257c6be2fae723f73c01505a5479e9e78646233b (diff)
*** empty log message ***
Diffstat (limited to 'lzfP.h')
-rw-r--r--lzfP.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/lzfP.h b/lzfP.h
index 7f0e02b..c54d087 100644
--- a/lzfP.h
+++ b/lzfP.h
@@ -121,27 +121,52 @@
# define CHECK_INPUT 1
#endif
+/*
+ * Whether to store pointers or offsets inside the hash table. On
+ * 64 bit architetcures, pointers take up twice as much space,
+ * and might also be slower. Default is to autodetect.
+ */
+/*#define LZF_USER_OFFSETS autodetect */
+
/*****************************************************************************/
/* nothing should be changed below */
#ifdef __cplusplus
# include <cstring>
+# include <climits>
using namespace std;
#else
# include <string.h>
+# include <limits.h>
+#endif
+
+#ifndef LZF_USE_OFFSETS
+# if defined (WIN32)
+# define LZF_USE_OFFSETS defined(_M_X64)
+# else
+# ifdef __cplusplus
+# include <cstdint>
+# else
+# include <stdint.h>
+# endif
+# define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU)
+# endif
#endif
typedef unsigned char u8;
-typedef const u8 *LZF_STATE[1 << (HLOG)];
+#if LZF_USE_OFFSETS
+# define LZF_HSLOT_BIAS ((const u8 *)in_data)
+ typedef unsigned int LZF_HSLOT;
+#else
+# define LZF_HSLOT_BIAS 0
+ typedef const u8 *LZF_HSLOT;
+#endif
+
+typedef LZF_HSLOT LZF_STATE[1 << (HLOG)];
#if !STRICT_ALIGN
/* for unaligned accesses we need a 16 bit datatype. */
-# ifdef __cplusplus
-# include <climits>
-# else
-# include <limits.h>
-# endif
# if USHRT_MAX == 65535
typedef unsigned short u16;
# elif UINT_MAX == 65535