lzoruby 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.txt → README} +3 -7
- data/ext/extconf.rb +4 -1
- metadata +24 -131
- data/ext/compr1b.h +0 -81
- data/ext/compr1c.h +0 -81
- data/ext/config1.h +0 -61
- data/ext/config1a.h +0 -196
- data/ext/config1b.h +0 -140
- data/ext/config1c.h +0 -145
- data/ext/config1f.h +0 -97
- data/ext/config1x.h +0 -118
- data/ext/config1y.h +0 -66
- data/ext/config1z.h +0 -65
- data/ext/config2a.h +0 -155
- data/ext/lzo/lzo1.h +0 -96
- data/ext/lzo/lzo1a.h +0 -96
- data/ext/lzo/lzo1b.h +0 -160
- data/ext/lzo/lzo1c.h +0 -160
- data/ext/lzo/lzo1f.h +0 -108
- data/ext/lzo/lzo1x.h +0 -177
- data/ext/lzo/lzo1y.h +0 -145
- data/ext/lzo/lzo1z.h +0 -150
- data/ext/lzo/lzo2a.h +0 -92
- data/ext/lzo/lzo_asm.h +0 -139
- data/ext/lzo/lzoconf.h +0 -417
- data/ext/lzo/lzodefs.h +0 -1807
- data/ext/lzo/lzoutil.h +0 -73
- data/ext/lzo1.c +0 -635
- data/ext/lzo1_99.c +0 -130
- data/ext/lzo1_cm.ch +0 -52
- data/ext/lzo1_d.ch +0 -155
- data/ext/lzo1a.c +0 -657
- data/ext/lzo1a_99.c +0 -130
- data/ext/lzo1a_cm.ch +0 -242
- data/ext/lzo1a_cr.ch +0 -128
- data/ext/lzo1a_de.h +0 -158
- data/ext/lzo1b_1.c +0 -46
- data/ext/lzo1b_2.c +0 -46
- data/ext/lzo1b_3.c +0 -46
- data/ext/lzo1b_4.c +0 -46
- data/ext/lzo1b_5.c +0 -46
- data/ext/lzo1b_6.c +0 -46
- data/ext/lzo1b_7.c +0 -46
- data/ext/lzo1b_8.c +0 -46
- data/ext/lzo1b_9.c +0 -46
- data/ext/lzo1b_99.c +0 -49
- data/ext/lzo1b_9x.c +0 -365
- data/ext/lzo1b_c.ch +0 -270
- data/ext/lzo1b_cc.c +0 -167
- data/ext/lzo1b_cc.h +0 -93
- data/ext/lzo1b_cm.ch +0 -294
- data/ext/lzo1b_cr.ch +0 -126
- data/ext/lzo1b_d.ch +0 -282
- data/ext/lzo1b_d1.c +0 -46
- data/ext/lzo1b_d2.c +0 -46
- data/ext/lzo1b_de.h +0 -344
- data/ext/lzo1b_r.ch +0 -117
- data/ext/lzo1b_rr.c +0 -43
- data/ext/lzo1b_sm.ch +0 -210
- data/ext/lzo1b_tm.ch +0 -99
- data/ext/lzo1b_xx.c +0 -98
- data/ext/lzo1c_1.c +0 -46
- data/ext/lzo1c_2.c +0 -46
- data/ext/lzo1c_3.c +0 -46
- data/ext/lzo1c_4.c +0 -46
- data/ext/lzo1c_5.c +0 -46
- data/ext/lzo1c_6.c +0 -46
- data/ext/lzo1c_7.c +0 -46
- data/ext/lzo1c_8.c +0 -46
- data/ext/lzo1c_9.c +0 -46
- data/ext/lzo1c_99.c +0 -49
- data/ext/lzo1c_9x.c +0 -379
- data/ext/lzo1c_cc.c +0 -167
- data/ext/lzo1c_cc.h +0 -93
- data/ext/lzo1c_d1.c +0 -46
- data/ext/lzo1c_d2.c +0 -46
- data/ext/lzo1c_rr.c +0 -43
- data/ext/lzo1c_xx.c +0 -98
- data/ext/lzo1f_1.c +0 -312
- data/ext/lzo1f_9x.c +0 -345
- data/ext/lzo1f_d.ch +0 -223
- data/ext/lzo1f_d1.c +0 -46
- data/ext/lzo1f_d2.c +0 -46
- data/ext/lzo1x_1.c +0 -50
- data/ext/lzo1x_1k.c +0 -50
- data/ext/lzo1x_1l.c +0 -50
- data/ext/lzo1x_1o.c +0 -50
- data/ext/lzo1x_9x.c +0 -881
- data/ext/lzo1x_c.ch +0 -351
- data/ext/lzo1x_d.ch +0 -466
- data/ext/lzo1x_d1.c +0 -46
- data/ext/lzo1x_d2.c +0 -46
- data/ext/lzo1x_d3.c +0 -108
- data/ext/lzo1x_o.c +0 -45
- data/ext/lzo1x_oo.ch +0 -366
- data/ext/lzo1y_1.c +0 -50
- data/ext/lzo1y_9x.c +0 -42
- data/ext/lzo1y_d1.c +0 -46
- data/ext/lzo1y_d2.c +0 -46
- data/ext/lzo1y_d3.c +0 -45
- data/ext/lzo1y_o.c +0 -45
- data/ext/lzo1z_9x.c +0 -42
- data/ext/lzo1z_d1.c +0 -46
- data/ext/lzo1z_d2.c +0 -46
- data/ext/lzo1z_d3.c +0 -45
- data/ext/lzo2a_9x.c +0 -357
- data/ext/lzo2a_d.ch +0 -188
- data/ext/lzo2a_d1.c +0 -46
- data/ext/lzo2a_d2.c +0 -46
- data/ext/lzo_conf.h +0 -323
- data/ext/lzo_crc.c +0 -167
- data/ext/lzo_dict.h +0 -316
- data/ext/lzo_dll.ch +0 -64
- data/ext/lzo_init.c +0 -176
- data/ext/lzo_mchw.ch +0 -242
- data/ext/lzo_ptr.c +0 -92
- data/ext/lzo_ptr.h +0 -154
- data/ext/lzo_str.c +0 -71
- data/ext/lzo_swd.ch +0 -707
- data/ext/lzo_util.c +0 -165
- data/ext/miniacc.h +0 -6553
- data/ext/stats1a.h +0 -137
- data/ext/stats1b.h +0 -142
- data/ext/stats1c.h +0 -61
data/ext/lzo_mchw.ch
DELETED
@@ -1,242 +0,0 @@
|
|
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
DELETED
@@ -1,92 +0,0 @@
|
|
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
DELETED
@@ -1,154 +0,0 @@
|
|
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
|
-
|