lzoruby 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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/lzo_mchw.ch ADDED
@@ -0,0 +1,242 @@
1
+ /* lzo_mchw.ch -- matching functions using a window
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
+ /***********************************************************************
42
+ //
43
+ ************************************************************************/
44
+
45
+ typedef struct
46
+ {
47
+ int init;
48
+
49
+ lzo_uint look; /* bytes in lookahead buffer */
50
+
51
+ lzo_uint m_len;
52
+ lzo_uint m_off;
53
+
54
+ lzo_uint last_m_len;
55
+ lzo_uint last_m_off;
56
+
57
+ const lzo_bytep bp;
58
+ const lzo_bytep ip;
59
+ const lzo_bytep in;
60
+ const lzo_bytep in_end;
61
+ lzo_bytep out;
62
+
63
+ lzo_callback_p cb;
64
+
65
+ lzo_uint textsize; /* text size counter */
66
+ lzo_uint codesize; /* code size counter */
67
+ lzo_uint printcount; /* counter for reporting progress every 1K bytes */
68
+
69
+ /* some stats */
70
+ unsigned long lit_bytes;
71
+ unsigned long match_bytes;
72
+ unsigned long rep_bytes;
73
+ unsigned long lazy;
74
+
75
+ #if defined(LZO1B)
76
+ lzo_uint r1_m_len;
77
+
78
+ /* some stats */
79
+ unsigned long r1_r, m3_r, m2_m, m3_m;
80
+ #endif
81
+
82
+ #if defined(LZO1C)
83
+ lzo_uint r1_m_len;
84
+ lzo_bytep m3;
85
+
86
+ /* some stats */
87
+ unsigned long r1_r, m3_r, m2_m, m3_m;
88
+ #endif
89
+
90
+ #if defined(LZO1F)
91
+ lzo_uint r1_lit;
92
+ lzo_uint r1_m_len;
93
+
94
+ /* some stats */
95
+ unsigned long r1_r, m2_m, m3_m;
96
+ #endif
97
+
98
+ #if defined(LZO1X) || defined(LZO1Y) || defined(LZO1Z)
99
+ lzo_uint r1_lit;
100
+ lzo_uint r1_m_len;
101
+
102
+ /* some stats */
103
+ unsigned long m1a_m, m1b_m, m2_m, m3_m, m4_m;
104
+ unsigned long lit1_r, lit2_r, lit3_r;
105
+ #endif
106
+
107
+ #if defined(LZO2A)
108
+ /* some stats */
109
+ unsigned long m1, m2, m3, m4;
110
+ #endif
111
+ }
112
+ LZO_COMPRESS_T;
113
+
114
+
115
+ #if (LZO_CC_BORLANDC && LZO_ARCH_I086) && (__BORLANDC__ < 0x0450)
116
+ /* work around a Borland C 3.1 bug */
117
+ # define getbyte(c) ((c).ip < (c).in_end ? (c).ip +=1, (c).ip[-1] : (-1))
118
+ #elif defined(__TURBOC__) && defined(__TOS__)
119
+ /* work around a bug in Turbo C / Pure C (Atari ST) */
120
+ # define getbyte(c) ((c).ip < (c).in_end ? (int)(unsigned) *((c).ip)++ : (-1))
121
+ #else
122
+ # define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1))
123
+ #endif
124
+
125
+ #include "lzo_swd.ch"
126
+
127
+
128
+ /***********************************************************************
129
+ //
130
+ ************************************************************************/
131
+
132
+ static int
133
+ init_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
134
+ const lzo_bytep dict, lzo_uint dict_len,
135
+ lzo_uint32 flags )
136
+ {
137
+ int r;
138
+
139
+ assert(!c->init);
140
+ c->init = 1;
141
+
142
+ s->c = c;
143
+
144
+ c->last_m_len = c->last_m_off = 0;
145
+
146
+ c->textsize = c->codesize = c->printcount = 0;
147
+ c->lit_bytes = c->match_bytes = c->rep_bytes = 0;
148
+ c->lazy = 0;
149
+
150
+ r = swd_init(s,dict,dict_len);
151
+ if (r != 0)
152
+ return r;
153
+
154
+ s->use_best_off = (flags & 1) ? 1 : 0;
155
+ return r;
156
+ }
157
+
158
+
159
+ /***********************************************************************
160
+ //
161
+ ************************************************************************/
162
+
163
+ static int
164
+ find_match ( LZO_COMPRESS_T *c, lzo_swd_p s,
165
+ lzo_uint this_len, lzo_uint skip )
166
+ {
167
+ assert(c->init);
168
+
169
+ if (skip > 0)
170
+ {
171
+ assert(this_len >= skip);
172
+ swd_accept(s, this_len - skip);
173
+ c->textsize += this_len - skip + 1;
174
+ }
175
+ else
176
+ {
177
+ assert(this_len <= 1);
178
+ c->textsize += this_len - skip;
179
+ }
180
+
181
+ s->m_len = 1;
182
+ s->m_len = THRESHOLD;
183
+ #ifdef SWD_BEST_OFF
184
+ if (s->use_best_off)
185
+ lzo_memset(s->best_pos,0,sizeof(s->best_pos));
186
+ #endif
187
+ swd_findbest(s);
188
+ c->m_len = s->m_len;
189
+ c->m_off = s->m_off;
190
+
191
+ swd_getbyte(s);
192
+
193
+ if (s->b_char < 0)
194
+ {
195
+ c->look = 0;
196
+ c->m_len = 0;
197
+ swd_exit(s);
198
+ }
199
+ else
200
+ {
201
+ c->look = s->look + 1;
202
+ }
203
+ c->bp = c->ip - c->look;
204
+
205
+ #if 0
206
+ /* brute force match search */
207
+ if (c->m_len > THRESHOLD && c->m_len + 1 <= c->look)
208
+ {
209
+ const lzo_bytep ip = c->bp;
210
+ const lzo_bytep m = c->bp - c->m_off;
211
+ const lzo_bytep in = c->in;
212
+
213
+ if (ip - in > N)
214
+ in = ip - N;
215
+ for (;;)
216
+ {
217
+ while (*in != *ip)
218
+ in++;
219
+ if (in == ip)
220
+ break;
221
+ if (in != m)
222
+ if (lzo_memcmp(in,ip,c->m_len+1) == 0)
223
+ printf("%p %p %p %5d\n",in,ip,m,c->m_len);
224
+ in++;
225
+ }
226
+ }
227
+ #endif
228
+
229
+ if (c->cb && c->cb->nprogress && c->textsize > c->printcount)
230
+ {
231
+ (*c->cb->nprogress)(c->cb, c->textsize, c->codesize, 0);
232
+ c->printcount += 1024;
233
+ }
234
+
235
+ return LZO_E_OK;
236
+ }
237
+
238
+
239
+ /*
240
+ vi:ts=4:et
241
+ */
242
+
data/ext/lzo_ptr.c ADDED
@@ -0,0 +1,92 @@
1
+ /* lzo_ptr.c -- low-level pointer constructs
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
+ //
46
+ ************************************************************************/
47
+
48
+ LZO_PUBLIC(lzo_uintptr_t)
49
+ __lzo_ptr_linear(const lzo_voidp ptr)
50
+ {
51
+ lzo_uintptr_t p;
52
+
53
+ #if (LZO_ARCH_I086)
54
+ p = (((lzo_uintptr_t)(ACC_PTR_FP_SEG(ptr))) << (16 - ACC_MM_AHSHIFT)) + (ACC_PTR_FP_OFF(ptr));
55
+ #elif (LZO_MM_PVP)
56
+ p = (lzo_uintptr_t) (ptr);
57
+ p = (p << 3) | (p >> 61);
58
+ #else
59
+ p = (lzo_uintptr_t) PTR_LINEAR(ptr);
60
+ #endif
61
+
62
+ return p;
63
+ }
64
+
65
+
66
+ /***********************************************************************
67
+ //
68
+ ************************************************************************/
69
+
70
+ LZO_PUBLIC(unsigned)
71
+ __lzo_align_gap(const lzo_voidp ptr, lzo_uint size)
72
+ {
73
+ #if defined(__LZO_UINTPTR_T_IS_POINTER)
74
+ size_t n = (size_t) ptr;
75
+ n = (((n + size - 1) / size) * size) - n;
76
+ #else
77
+ lzo_uintptr_t p, n;
78
+ p = __lzo_ptr_linear(ptr);
79
+ n = (((p + size - 1) / size) * size) - p;
80
+ #endif
81
+
82
+ assert(size > 0);
83
+ assert((long)n >= 0);
84
+ assert(n <= size);
85
+ return (unsigned)n;
86
+ }
87
+
88
+
89
+
90
+ /*
91
+ vi:ts=4:et
92
+ */
data/ext/lzo_ptr.h ADDED
@@ -0,0 +1,154 @@
1
+ /* lzo_ptr.h -- low-level pointer constructs
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_PTR_H
48
+ #define __LZO_PTR_H
49
+
50
+ #ifdef __cplusplus
51
+ extern "C" {
52
+ #endif
53
+
54
+
55
+ /***********************************************************************
56
+ // Integral types
57
+ ************************************************************************/
58
+
59
+ #if !defined(lzo_uintptr_t)
60
+ # if defined(__LZO_MMODEL_HUGE)
61
+ # define lzo_uintptr_t unsigned long
62
+ # else
63
+ # define lzo_uintptr_t acc_uintptr_t
64
+ # ifdef __ACC_INTPTR_T_IS_POINTER
65
+ # define __LZO_UINTPTR_T_IS_POINTER 1
66
+ # endif
67
+ # endif
68
+ #endif
69
+
70
+
71
+ /***********************************************************************
72
+ //
73
+ ************************************************************************/
74
+
75
+ /* Always use the safe (=integral) version for pointer-comparisions.
76
+ * The compiler should optimize away the additional casts anyway.
77
+ *
78
+ * Note that this only works if the representation and ordering
79
+ * of the pointer and the integral is the same (at bit level).
80
+ *
81
+ * Most 16-bit compilers have their own view about pointers -
82
+ * fortunately they don't care about comparing pointers
83
+ * that are pointing to Nirvana.
84
+ */
85
+
86
+ #if (LZO_ARCH_I086)
87
+ #define PTR(a) ((lzo_bytep) (a))
88
+ /* only need the low bits of the pointer -> offset is ok */
89
+ #define PTR_ALIGNED_4(a) ((ACC_PTR_FP_OFF(a) & 3) == 0)
90
+ #define PTR_ALIGNED2_4(a,b) (((ACC_PTR_FP_OFF(a) | ACC_PTR_FP_OFF(b)) & 3) == 0)
91
+ #elif (LZO_MM_PVP)
92
+ #define PTR(a) ((lzo_bytep) (a))
93
+ #define PTR_ALIGNED_8(a) ((((lzo_uintptr_t)(a)) >> 61) == 0)
94
+ #define PTR_ALIGNED2_8(a,b) ((((lzo_uintptr_t)(a)|(lzo_uintptr_t)(b)) >> 61) == 0)
95
+ #else
96
+ #define PTR(a) ((lzo_uintptr_t) (a))
97
+ #define PTR_LINEAR(a) PTR(a)
98
+ #define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0)
99
+ #define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0)
100
+ #define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0)
101
+ #define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0)
102
+ #endif
103
+
104
+ #define PTR_LT(a,b) (PTR(a) < PTR(b))
105
+ #define PTR_GE(a,b) (PTR(a) >= PTR(b))
106
+ #define PTR_DIFF(a,b) (PTR(a) - PTR(b))
107
+ #define pd(a,b) ((lzo_uint) ((a)-(b)))
108
+
109
+
110
+ LZO_EXTERN(lzo_uintptr_t)
111
+ __lzo_ptr_linear(const lzo_voidp ptr);
112
+
113
+
114
+ typedef union
115
+ {
116
+ char a_char;
117
+ unsigned char a_uchar;
118
+ short a_short;
119
+ unsigned short a_ushort;
120
+ int a_int;
121
+ unsigned int a_uint;
122
+ long a_long;
123
+ unsigned long a_ulong;
124
+ lzo_int a_lzo_int;
125
+ lzo_uint a_lzo_uint;
126
+ lzo_int32 a_lzo_int32;
127
+ lzo_uint32 a_lzo_uint32;
128
+ ptrdiff_t a_ptrdiff_t;
129
+ lzo_uintptr_t a_lzo_uintptr_t;
130
+ lzo_voidp a_lzo_voidp;
131
+ void * a_void_p;
132
+ lzo_bytep a_lzo_bytep;
133
+ lzo_bytepp a_lzo_bytepp;
134
+ lzo_uintp a_lzo_uintp;
135
+ lzo_uint * a_lzo_uint_p;
136
+ lzo_uint32p a_lzo_uint32p;
137
+ lzo_uint32 * a_lzo_uint32_p;
138
+ unsigned char * a_uchar_p;
139
+ char * a_char_p;
140
+ }
141
+ lzo_full_align_t;
142
+
143
+
144
+
145
+ #ifdef __cplusplus
146
+ } /* extern "C" */
147
+ #endif
148
+
149
+ #endif /* already included */
150
+
151
+ /*
152
+ vi:ts=4:et
153
+ */
154
+
data/ext/lzo_str.c ADDED
@@ -0,0 +1,71 @@
1
+ /* lzo_str.c -- string functions 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
+ #undef lzo_memcmp
44
+ #undef lzo_memcpy
45
+ #undef lzo_memmove
46
+ #undef lzo_memset
47
+
48
+
49
+ /***********************************************************************
50
+ // slow but portable <string.h> stuff, only used in assertions
51
+ ************************************************************************/
52
+
53
+ #if !defined(__LZO_MMODEL_HUGE)
54
+ # undef ACC_HAVE_MM_HUGE_PTR
55
+ #endif
56
+ #define acc_hsize_t lzo_uint
57
+ #define acc_hvoid_p lzo_voidp
58
+ #define acc_hbyte_p lzo_bytep
59
+ #define ACCLIB_PUBLIC(r,f) LZO_PUBLIC(r) f
60
+ #define acc_hmemcmp lzo_memcmp
61
+ #define acc_hmemcpy lzo_memcpy
62
+ #define acc_hmemmove lzo_memmove
63
+ #define acc_hmemset lzo_memset
64
+ #define ACC_WANT_ACCLIB_HMEMCPY 1
65
+ #include "miniacc.h"
66
+ #undef ACCLIB_PUBLIC
67
+
68
+
69
+ /*
70
+ vi:ts=4:et
71
+ */