lzoruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/LICENSE.txt +339 -0
  2. data/README.txt +57 -0
  3. data/ext/compr1b.h +81 -0
  4. data/ext/compr1c.h +81 -0
  5. data/ext/config1.h +61 -0
  6. data/ext/config1a.h +196 -0
  7. data/ext/config1b.h +140 -0
  8. data/ext/config1c.h +145 -0
  9. data/ext/config1f.h +97 -0
  10. data/ext/config1x.h +118 -0
  11. data/ext/config1y.h +66 -0
  12. data/ext/config1z.h +65 -0
  13. data/ext/config2a.h +155 -0
  14. data/ext/extconf.rb +2 -0
  15. data/ext/lzo/lzo1.h +96 -0
  16. data/ext/lzo/lzo1a.h +96 -0
  17. data/ext/lzo/lzo1b.h +160 -0
  18. data/ext/lzo/lzo1c.h +160 -0
  19. data/ext/lzo/lzo1f.h +108 -0
  20. data/ext/lzo/lzo1x.h +177 -0
  21. data/ext/lzo/lzo1y.h +145 -0
  22. data/ext/lzo/lzo1z.h +150 -0
  23. data/ext/lzo/lzo2a.h +92 -0
  24. data/ext/lzo/lzo_asm.h +139 -0
  25. data/ext/lzo/lzoconf.h +417 -0
  26. data/ext/lzo/lzodefs.h +1807 -0
  27. data/ext/lzo/lzoutil.h +73 -0
  28. data/ext/lzo1.c +635 -0
  29. data/ext/lzo1_99.c +130 -0
  30. data/ext/lzo1_cm.ch +52 -0
  31. data/ext/lzo1_d.ch +155 -0
  32. data/ext/lzo1a.c +657 -0
  33. data/ext/lzo1a_99.c +130 -0
  34. data/ext/lzo1a_cm.ch +242 -0
  35. data/ext/lzo1a_cr.ch +128 -0
  36. data/ext/lzo1a_de.h +158 -0
  37. data/ext/lzo1b_1.c +46 -0
  38. data/ext/lzo1b_2.c +46 -0
  39. data/ext/lzo1b_3.c +46 -0
  40. data/ext/lzo1b_4.c +46 -0
  41. data/ext/lzo1b_5.c +46 -0
  42. data/ext/lzo1b_6.c +46 -0
  43. data/ext/lzo1b_7.c +46 -0
  44. data/ext/lzo1b_8.c +46 -0
  45. data/ext/lzo1b_9.c +46 -0
  46. data/ext/lzo1b_99.c +49 -0
  47. data/ext/lzo1b_9x.c +365 -0
  48. data/ext/lzo1b_c.ch +270 -0
  49. data/ext/lzo1b_cc.c +167 -0
  50. data/ext/lzo1b_cc.h +93 -0
  51. data/ext/lzo1b_cm.ch +294 -0
  52. data/ext/lzo1b_cr.ch +126 -0
  53. data/ext/lzo1b_d.ch +282 -0
  54. data/ext/lzo1b_d1.c +46 -0
  55. data/ext/lzo1b_d2.c +46 -0
  56. data/ext/lzo1b_de.h +344 -0
  57. data/ext/lzo1b_r.ch +117 -0
  58. data/ext/lzo1b_rr.c +43 -0
  59. data/ext/lzo1b_sm.ch +210 -0
  60. data/ext/lzo1b_tm.ch +99 -0
  61. data/ext/lzo1b_xx.c +98 -0
  62. data/ext/lzo1c_1.c +46 -0
  63. data/ext/lzo1c_2.c +46 -0
  64. data/ext/lzo1c_3.c +46 -0
  65. data/ext/lzo1c_4.c +46 -0
  66. data/ext/lzo1c_5.c +46 -0
  67. data/ext/lzo1c_6.c +46 -0
  68. data/ext/lzo1c_7.c +46 -0
  69. data/ext/lzo1c_8.c +46 -0
  70. data/ext/lzo1c_9.c +46 -0
  71. data/ext/lzo1c_99.c +49 -0
  72. data/ext/lzo1c_9x.c +379 -0
  73. data/ext/lzo1c_cc.c +167 -0
  74. data/ext/lzo1c_cc.h +93 -0
  75. data/ext/lzo1c_d1.c +46 -0
  76. data/ext/lzo1c_d2.c +46 -0
  77. data/ext/lzo1c_rr.c +43 -0
  78. data/ext/lzo1c_xx.c +98 -0
  79. data/ext/lzo1f_1.c +312 -0
  80. data/ext/lzo1f_9x.c +345 -0
  81. data/ext/lzo1f_d.ch +223 -0
  82. data/ext/lzo1f_d1.c +46 -0
  83. data/ext/lzo1f_d2.c +46 -0
  84. data/ext/lzo1x_1.c +50 -0
  85. data/ext/lzo1x_1k.c +50 -0
  86. data/ext/lzo1x_1l.c +50 -0
  87. data/ext/lzo1x_1o.c +50 -0
  88. data/ext/lzo1x_9x.c +881 -0
  89. data/ext/lzo1x_c.ch +351 -0
  90. data/ext/lzo1x_d.ch +466 -0
  91. data/ext/lzo1x_d1.c +46 -0
  92. data/ext/lzo1x_d2.c +46 -0
  93. data/ext/lzo1x_d3.c +108 -0
  94. data/ext/lzo1x_o.c +45 -0
  95. data/ext/lzo1x_oo.ch +366 -0
  96. data/ext/lzo1y_1.c +50 -0
  97. data/ext/lzo1y_9x.c +42 -0
  98. data/ext/lzo1y_d1.c +46 -0
  99. data/ext/lzo1y_d2.c +46 -0
  100. data/ext/lzo1y_d3.c +45 -0
  101. data/ext/lzo1y_o.c +45 -0
  102. data/ext/lzo1z_9x.c +42 -0
  103. data/ext/lzo1z_d1.c +46 -0
  104. data/ext/lzo1z_d2.c +46 -0
  105. data/ext/lzo1z_d3.c +45 -0
  106. data/ext/lzo2a_9x.c +357 -0
  107. data/ext/lzo2a_d.ch +188 -0
  108. data/ext/lzo2a_d1.c +46 -0
  109. data/ext/lzo2a_d2.c +46 -0
  110. data/ext/lzo_conf.h +323 -0
  111. data/ext/lzo_crc.c +167 -0
  112. data/ext/lzo_dict.h +316 -0
  113. data/ext/lzo_dll.ch +64 -0
  114. data/ext/lzo_init.c +176 -0
  115. data/ext/lzo_mchw.ch +242 -0
  116. data/ext/lzo_ptr.c +92 -0
  117. data/ext/lzo_ptr.h +154 -0
  118. data/ext/lzo_str.c +71 -0
  119. data/ext/lzo_swd.ch +707 -0
  120. data/ext/lzo_util.c +165 -0
  121. data/ext/lzoruby.c +149 -0
  122. data/ext/miniacc.h +6553 -0
  123. data/ext/stats1a.h +137 -0
  124. data/ext/stats1b.h +142 -0
  125. data/ext/stats1c.h +61 -0
  126. metadata +180 -0
data/ext/lzo2a_d1.c ADDED
@@ -0,0 +1,46 @@
1
+ /* lzo2a_d1.c -- LZO2A decompression with overrun testing
2
+
3
+ This file is part of the LZO real-time data compression library.
4
+
5
+ Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
6
+ Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
7
+ Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
8
+ Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
9
+ Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
10
+ Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
11
+ Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
12
+ Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
13
+ Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
14
+ Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
15
+ Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
16
+ Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
17
+ Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
18
+ All Rights Reserved.
19
+
20
+ The LZO library is free software; you can redistribute it and/or
21
+ modify it under the terms of the GNU General Public License as
22
+ published by the Free Software Foundation; either version 2 of
23
+ the License, or (at your option) any later version.
24
+
25
+ The LZO library is distributed in the hope that it will be useful,
26
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ GNU General Public License for more details.
29
+
30
+ You should have received a copy of the GNU General Public License
31
+ along with the LZO library; see the file COPYING.
32
+ If not, write to the Free Software Foundation, Inc.,
33
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
+
35
+ Markus F.X.J. Oberhumer
36
+ <markus@oberhumer.com>
37
+ http://www.oberhumer.com/opensource/lzo/
38
+ */
39
+
40
+
41
+ #include "config2a.h"
42
+
43
+ #undef LZO_TEST_OVERRUN
44
+ #define DO_DECOMPRESS lzo2a_decompress
45
+
46
+ #include "lzo2a_d.ch"
data/ext/lzo2a_d2.c ADDED
@@ -0,0 +1,46 @@
1
+ /* lzo2a_d2.c -- LZO2A decompression with overrun testing
2
+
3
+ This file is part of the LZO real-time data compression library.
4
+
5
+ Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
6
+ Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
7
+ Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
8
+ Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
9
+ Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
10
+ Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
11
+ Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
12
+ Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
13
+ Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
14
+ Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
15
+ Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
16
+ Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
17
+ Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
18
+ All Rights Reserved.
19
+
20
+ The LZO library is free software; you can redistribute it and/or
21
+ modify it under the terms of the GNU General Public License as
22
+ published by the Free Software Foundation; either version 2 of
23
+ the License, or (at your option) any later version.
24
+
25
+ The LZO library is distributed in the hope that it will be useful,
26
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ GNU General Public License for more details.
29
+
30
+ You should have received a copy of the GNU General Public License
31
+ along with the LZO library; see the file COPYING.
32
+ If not, write to the Free Software Foundation, Inc.,
33
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
+
35
+ Markus F.X.J. Oberhumer
36
+ <markus@oberhumer.com>
37
+ http://www.oberhumer.com/opensource/lzo/
38
+ */
39
+
40
+
41
+ #include "config2a.h"
42
+
43
+ #define LZO_TEST_OVERRUN
44
+ #define DO_DECOMPRESS lzo2a_decompress_safe
45
+
46
+ #include "lzo2a_d.ch"
data/ext/lzo_conf.h ADDED
@@ -0,0 +1,323 @@
1
+ /* lzo_conf.h -- main internal configuration file for the the LZO library
2
+
3
+ This file is part of the LZO real-time data compression library.
4
+
5
+ Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
6
+ Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
7
+ Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
8
+ Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
9
+ Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
10
+ Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
11
+ Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
12
+ Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
13
+ Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
14
+ Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
15
+ Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
16
+ Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
17
+ Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
18
+ All Rights Reserved.
19
+
20
+ The LZO library is free software; you can redistribute it and/or
21
+ modify it under the terms of the GNU General Public License as
22
+ published by the Free Software Foundation; either version 2 of
23
+ the License, or (at your option) any later version.
24
+
25
+ The LZO library is distributed in the hope that it will be useful,
26
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ GNU General Public License for more details.
29
+
30
+ You should have received a copy of the GNU General Public License
31
+ along with the LZO library; see the file COPYING.
32
+ If not, write to the Free Software Foundation, Inc.,
33
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
+
35
+ Markus F.X.J. Oberhumer
36
+ <markus@oberhumer.com>
37
+ http://www.oberhumer.com/opensource/lzo/
38
+ */
39
+
40
+
41
+ /* WARNING: this file should *not* be used by applications. It is
42
+ part of the implementation of the library and is subject
43
+ to change.
44
+ */
45
+
46
+
47
+ #ifndef __LZO_CONF_H
48
+ #define __LZO_CONF_H
49
+
50
+ #if !defined(__LZO_IN_MINILZO)
51
+ #if defined(LZO_CFG_FREESTANDING)
52
+ # define LZO_LIBC_FREESTANDING 1
53
+ # define LZO_OS_FREESTANDING 1
54
+ # define ACC_LIBC_FREESTANDING 1
55
+ # define ACC_OS_FREESTANDING 1
56
+ #endif
57
+ #if defined(LZO_CFG_NO_UNALIGNED)
58
+ # define ACC_CFG_NO_UNALIGNED 1
59
+ #endif
60
+ #if defined(LZO_ARCH_GENERIC)
61
+ # define ACC_ARCH_GENERIC 1
62
+ #endif
63
+ #if defined(LZO_ABI_NEUTRAL_ENDIAN)
64
+ # define ACC_ABI_NEUTRAL_ENDIAN 1
65
+ #endif
66
+ #if defined(LZO_HAVE_CONFIG_H)
67
+ # define ACC_CONFIG_NO_HEADER 1
68
+ #endif
69
+ #if defined(LZO_CFG_EXTRA_CONFIG_HEADER)
70
+ # include LZO_CFG_EXTRA_CONFIG_HEADER
71
+ #endif
72
+ #if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED)
73
+ # error "include this file first"
74
+ #endif
75
+ #include "lzo/lzoconf.h"
76
+ #endif
77
+
78
+ #if (LZO_VERSION < 0x02000) || !defined(__LZOCONF_H_INCLUDED)
79
+ # error "version mismatch"
80
+ #endif
81
+
82
+
83
+ /***********************************************************************
84
+ // pragmas
85
+ ************************************************************************/
86
+
87
+ #if (LZO_CC_BORLANDC && LZO_ARCH_I086)
88
+ # pragma option -h /* enable fast huge pointers */
89
+ #endif
90
+
91
+ #if (LZO_CC_MSC && (_MSC_VER >= 1000))
92
+ # pragma warning(disable: 4127 4701)
93
+ #endif
94
+ #if (LZO_CC_MSC && (_MSC_VER >= 1300))
95
+ /* avoid `-Wall' warnings in system header files */
96
+ # pragma warning(disable: 4820)
97
+ /* avoid warnings about inlining */
98
+ # pragma warning(disable: 4514 4710 4711)
99
+ #endif
100
+
101
+ #if (LZO_CC_SUNPROC)
102
+ # pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED)
103
+ # pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP)
104
+ #endif
105
+
106
+
107
+ /***********************************************************************
108
+ //
109
+ ************************************************************************/
110
+
111
+ #if defined(__LZO_MMODEL_HUGE) && (!LZO_HAVE_MM_HUGE_PTR)
112
+ # error "this should not happen - check defines for __huge"
113
+ #endif
114
+
115
+ #if defined(__LZO_IN_MINILZO) || defined(LZO_CFG_FREESTANDING)
116
+ #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
117
+ # define ACC_WANT_ACC_INCD_H 1
118
+ # define ACC_WANT_ACC_INCE_H 1
119
+ # define ACC_WANT_ACC_INCI_H 1
120
+ #elif 1
121
+ # include <string.h>
122
+ #else
123
+ # define ACC_WANT_ACC_INCD_H 1
124
+ #endif
125
+ #include "miniacc.h"
126
+
127
+
128
+ #if defined(LZO_CFG_FREESTANDING)
129
+ # undef HAVE_MEMCMP
130
+ # undef HAVE_MEMCPY
131
+ # undef HAVE_MEMMOVE
132
+ # undef HAVE_MEMSET
133
+ #endif
134
+
135
+ #if !defined(HAVE_MEMCMP)
136
+ # undef memcmp
137
+ # define memcmp(a,b,c) lzo_memcmp(a,b,c)
138
+ #elif !defined(__LZO_MMODEL_HUGE)
139
+ # define lzo_memcmp(a,b,c) memcmp(a,b,c)
140
+ #endif
141
+ #if !defined(HAVE_MEMCPY)
142
+ # undef memcpy
143
+ # define memcpy(a,b,c) lzo_memcpy(a,b,c)
144
+ #elif !defined(__LZO_MMODEL_HUGE)
145
+ # define lzo_memcpy(a,b,c) memcpy(a,b,c)
146
+ #endif
147
+ #if !defined(HAVE_MEMMOVE)
148
+ # undef memmove
149
+ # define memmove(a,b,c) lzo_memmove(a,b,c)
150
+ #elif !defined(__LZO_MMODEL_HUGE)
151
+ # define lzo_memmove(a,b,c) memmove(a,b,c)
152
+ #endif
153
+ #if !defined(HAVE_MEMSET)
154
+ # undef memset
155
+ # define memset(a,b,c) lzo_memset(a,b,c)
156
+ #elif !defined(__LZO_MMODEL_HUGE)
157
+ # define lzo_memset(a,b,c) memset(a,b,c)
158
+ #endif
159
+
160
+
161
+ #undef NDEBUG
162
+ #if defined(LZO_CFG_FREESTANDING)
163
+ # undef LZO_DEBUG
164
+ # define NDEBUG 1
165
+ # undef assert
166
+ # define assert(e) ((void)0)
167
+ #else
168
+ # if !defined(LZO_DEBUG)
169
+ # define NDEBUG 1
170
+ # endif
171
+ # include <assert.h>
172
+ #endif
173
+
174
+ #if 0 && defined(__BOUNDS_CHECKING_ON)
175
+ # include <unchecked.h>
176
+ #else
177
+ # define BOUNDS_CHECKING_OFF_DURING(stmt) stmt
178
+ # define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr)
179
+ #endif
180
+
181
+ #if !defined(__lzo_inline)
182
+ # define __lzo_inline
183
+ #endif
184
+ #if !defined(__lzo_forceinline)
185
+ # define __lzo_forceinline
186
+ #endif
187
+ #if !defined(__lzo_noinline)
188
+ # define __lzo_noinline
189
+ #endif
190
+
191
+
192
+ /***********************************************************************
193
+ //
194
+ ************************************************************************/
195
+
196
+ #if 1
197
+ # define LZO_BYTE(x) ((unsigned char) (x))
198
+ #else
199
+ # define LZO_BYTE(x) ((unsigned char) ((x) & 0xff))
200
+ #endif
201
+
202
+ #define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b))
203
+ #define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b))
204
+ #define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c))
205
+ #define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c))
206
+
207
+ #define lzo_sizeof(type) ((lzo_uint) (sizeof(type)))
208
+
209
+ #define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array))))
210
+
211
+ /* this always fits into 16 bits */
212
+ #define LZO_SIZE(bits) (1u << (bits))
213
+ #define LZO_MASK(bits) (LZO_SIZE(bits) - 1)
214
+
215
+ #define LZO_LSIZE(bits) (1ul << (bits))
216
+ #define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1)
217
+
218
+ #define LZO_USIZE(bits) ((lzo_uint) 1 << (bits))
219
+ #define LZO_UMASK(bits) (LZO_USIZE(bits) - 1)
220
+
221
+ #if !defined(DMUL)
222
+ #if 0
223
+ /* 32*32 multiplies may be faster than 64*64 on some 64-bit machines,
224
+ * but then we need extra casts from unsigned<->size_t */
225
+ # define DMUL(a,b) ((lzo_xint) ((lzo_uint32)(a) * (lzo_uint32)(b)))
226
+ #else
227
+ # define DMUL(a,b) ((lzo_xint) ((a) * (b)))
228
+ #endif
229
+ #endif
230
+
231
+
232
+ /***********************************************************************
233
+ // compiler and architecture specific stuff
234
+ ************************************************************************/
235
+
236
+ /* Some defines that indicate if memory can be accessed at unaligned
237
+ * memory addresses. You should also test that this is actually faster
238
+ * even if it is allowed by your system.
239
+ */
240
+
241
+ #if 1 && !defined(LZO_CFG_NO_UNALIGNED)
242
+ #if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
243
+ # if (LZO_SIZEOF_SHORT == 2)
244
+ # define LZO_UNALIGNED_OK_2
245
+ # endif
246
+ # if (LZO_SIZEOF_INT == 4)
247
+ # define LZO_UNALIGNED_OK_4
248
+ # endif
249
+ #endif
250
+ #endif
251
+
252
+ #if defined(LZO_UNALIGNED_OK_2)
253
+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2)
254
+ #endif
255
+ #if defined(LZO_UNALIGNED_OK_4)
256
+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4)
257
+ #elif defined(LZO_ALIGNED_OK_4)
258
+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4)
259
+ #endif
260
+
261
+
262
+ /* Fast memcpy that copies multiples of 8 byte chunks.
263
+ * len is the number of bytes.
264
+ * note: all parameters must be lvalues, len >= 8
265
+ * dest and src advance, len is undefined afterwards
266
+ */
267
+
268
+ #define MEMCPY8_DS(dest,src,len) \
269
+ lzo_memcpy(dest,src,len); dest += len; src += len
270
+
271
+ #define BZERO8_PTR(s,l,n) \
272
+ lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n))
273
+
274
+ #define MEMCPY_DS(dest,src,len) \
275
+ do *dest++ = *src++; while (--len > 0)
276
+
277
+
278
+ /***********************************************************************
279
+ // some globals
280
+ ************************************************************************/
281
+
282
+ __LZO_EXTERN_C int __lzo_init_done;
283
+ __LZO_EXTERN_C const char __lzo_copyright[];
284
+ LZO_EXTERN(const lzo_bytep) lzo_copyright(void);
285
+
286
+
287
+ /***********************************************************************
288
+ //
289
+ ************************************************************************/
290
+
291
+ #include "lzo_ptr.h"
292
+
293
+
294
+ /* Generate compressed data in a deterministic way.
295
+ * This is fully portable, and compression can be faster as well.
296
+ * A reason NOT to be deterministic is when the block size is
297
+ * very small (e.g. 8kB) or the dictionary is big, because
298
+ * then the initialization of the dictionary becomes a relevant
299
+ * magnitude for compression speed.
300
+ */
301
+ #define LZO_DETERMINISTIC
302
+
303
+
304
+ #define LZO_DICT_USE_PTR
305
+ #if 0 && (LZO_ARCH_I086)
306
+ # undef LZO_DICT_USE_PTR
307
+ #endif
308
+
309
+ #if defined(LZO_DICT_USE_PTR)
310
+ # define lzo_dict_t const lzo_bytep
311
+ # define lzo_dict_p lzo_dict_t __LZO_MMODEL *
312
+ #else
313
+ # define lzo_dict_t lzo_uint
314
+ # define lzo_dict_p lzo_dict_t __LZO_MMODEL *
315
+ #endif
316
+
317
+
318
+ #endif /* already included */
319
+
320
+ /*
321
+ vi:ts=4:et
322
+ */
323
+
data/ext/lzo_crc.c ADDED
@@ -0,0 +1,167 @@
1
+ /* lzo_crc.c -- crc checksum for the the LZO library
2
+
3
+ This file is part of the LZO real-time data compression library.
4
+
5
+ Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
6
+ Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
7
+ Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
8
+ Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
9
+ Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
10
+ Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
11
+ Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
12
+ Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
13
+ Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
14
+ Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
15
+ Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
16
+ Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
17
+ Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
18
+ All Rights Reserved.
19
+
20
+ The LZO library is free software; you can redistribute it and/or
21
+ modify it under the terms of the GNU General Public License as
22
+ published by the Free Software Foundation; either version 2 of
23
+ the License, or (at your option) any later version.
24
+
25
+ The LZO library is distributed in the hope that it will be useful,
26
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ GNU General Public License for more details.
29
+
30
+ You should have received a copy of the GNU General Public License
31
+ along with the LZO library; see the file COPYING.
32
+ If not, write to the Free Software Foundation, Inc.,
33
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
+
35
+ Markus F.X.J. Oberhumer
36
+ <markus@oberhumer.com>
37
+ http://www.oberhumer.com/opensource/lzo/
38
+ */
39
+
40
+
41
+ #include "lzo_conf.h"
42
+
43
+
44
+ /***********************************************************************
45
+ // crc32 checksum
46
+ // adapted from free code by Mark Adler <madler@alumni.caltech.edu>
47
+ // see http://www.zlib.org/
48
+ ************************************************************************/
49
+
50
+ static const lzo_uint32 lzo_crc32_table[256] = {
51
+ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
52
+ 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
53
+ 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
54
+ 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
55
+ 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
56
+ 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
57
+ 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
58
+ 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
59
+ 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
60
+ 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
61
+ 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
62
+ 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
63
+ 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
64
+ 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
65
+ 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
66
+ 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
67
+ 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
68
+ 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
69
+ 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
70
+ 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
71
+ 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
72
+ 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
73
+ 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
74
+ 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
75
+ 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
76
+ 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
77
+ 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
78
+ 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
79
+ 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
80
+ 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
81
+ 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
82
+ 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
83
+ 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
84
+ 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
85
+ 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
86
+ 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
87
+ 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
88
+ 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
89
+ 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
90
+ 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
91
+ 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
92
+ 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
93
+ 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
94
+ 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
95
+ 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
96
+ 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
97
+ 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
98
+ 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
99
+ 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
100
+ 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
101
+ 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
102
+ 0x2d02ef8dL
103
+ };
104
+
105
+
106
+ LZO_PUBLIC(const lzo_uint32p)
107
+ lzo_get_crc32_table(void)
108
+ {
109
+ return lzo_crc32_table;
110
+ }
111
+
112
+
113
+ #if 1
114
+ #define LZO_DO1(buf,i) \
115
+ crc = table[((int)crc ^ buf[i]) & 0xff] ^ (crc >> 8)
116
+ #else
117
+ #define LZO_DO1(buf,i) \
118
+ crc = table[(unsigned char)((unsigned char)crc ^ buf[i])] ^ (crc >> 8)
119
+ #endif
120
+ #define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1);
121
+ #define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2);
122
+ #define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4);
123
+ #define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8);
124
+
125
+
126
+ LZO_PUBLIC(lzo_uint32)
127
+ lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len)
128
+ {
129
+ lzo_uint32 crc;
130
+ #undef table
131
+ #if 1
132
+ # define table lzo_crc32_table
133
+ #else
134
+ const lzo_uint32 * table = lzo_crc32_table;
135
+ #endif
136
+
137
+ if (buf == NULL)
138
+ return 0;
139
+
140
+ crc = (c & LZO_UINT32_C(0xffffffff)) ^ LZO_UINT32_C(0xffffffff);
141
+ if (len >= 16) do
142
+ {
143
+ LZO_DO16(buf,0);
144
+ buf += 16;
145
+ len -= 16;
146
+ } while (len >= 16);
147
+ if (len != 0) do
148
+ {
149
+ LZO_DO1(buf,0);
150
+ buf += 1;
151
+ len -= 1;
152
+ } while (len > 0);
153
+
154
+ return crc ^ LZO_UINT32_C(0xffffffff);
155
+ #undef table
156
+ }
157
+
158
+ #undef LZO_DO1
159
+ #undef LZO_DO2
160
+ #undef LZO_DO4
161
+ #undef LZO_DO8
162
+ #undef LZO_DO16
163
+
164
+
165
+ /*
166
+ vi:ts=4:et
167
+ */