aboutsummaryrefslogtreecommitdiff
path: root/bzlib_private.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bzlib_private.h47
1 files changed, 26 insertions, 21 deletions
diff --git a/bzlib_private.h b/bzlib_private.h
index 4044aef..8e93480 100644
--- a/bzlib_private.h
+++ b/bzlib_private.h
@@ -8,7 +8,7 @@
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is a part of bzip2 and/or libbzip2, a program and
9 library for lossless, block-sorting data compression. 9 library for lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-1998 Julian R Seward. All rights reserved. 11 Copyright (C) 1996-1999 Julian R Seward. All rights reserved.
12 12
13 Redistribution and use in source and binary forms, with or without 13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions 14 modification, are permitted provided that the following conditions
@@ -41,9 +41,9 @@
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 43
44 Julian Seward, Guildford, Surrey, UK. 44 Julian Seward, Cambridge, UK.
45 jseward@acm.org 45 jseward@acm.org
46 bzip2/libbzip2 version 0.9.0c of 18 October 1998 46 bzip2/libbzip2 version 0.9.5 of 24 May 1999
47 47
48 This program is based on (at least) the work of: 48 This program is based on (at least) the work of:
49 Mike Burrows 49 Mike Burrows
@@ -76,7 +76,7 @@
76 76
77/*-- General stuff. --*/ 77/*-- General stuff. --*/
78 78
79#define BZ_VERSION "0.9.0c" 79#define BZ_VERSION "0.9.5d"
80 80
81typedef char Char; 81typedef char Char;
82typedef unsigned char Bool; 82typedef unsigned char Bool;
@@ -85,7 +85,7 @@ typedef int Int32;
85typedef unsigned int UInt32; 85typedef unsigned int UInt32;
86typedef short Int16; 86typedef short Int16;
87typedef unsigned short UInt16; 87typedef unsigned short UInt16;
88 88
89#define True ((Bool)1) 89#define True ((Bool)1)
90#define False ((Bool)0) 90#define False ((Bool)0)
91 91
@@ -210,7 +210,11 @@ extern UInt32 crc32Table[256];
210#define BZ_S_OUTPUT 1 210#define BZ_S_OUTPUT 1
211#define BZ_S_INPUT 2 211#define BZ_S_INPUT 2
212 212
213#define BZ_NUM_OVERSHOOT_BYTES 20 213#define BZ_N_RADIX 2
214#define BZ_N_QSORT 12
215#define BZ_N_SHELL 18
216#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2)
217
214 218
215 219
216 220
@@ -230,18 +234,20 @@ typedef
230 UInt32 avail_in_expect; 234 UInt32 avail_in_expect;
231 235
232 /* for doing the block sorting */ 236 /* for doing the block sorting */
233 UChar* block; 237 UInt32* arr1;
234 UInt16* quadrant; 238 UInt32* arr2;
235 UInt32* zptr; 239 UInt32* ftab;
236 UInt16* szptr;
237 Int32* ftab;
238 Int32 workDone;
239 Int32 workLimit;
240 Int32 workFactor;
241 Bool firstAttempt;
242 Bool blockRandomised;
243 Int32 origPtr; 240 Int32 origPtr;
244 241
242 /* aliases for arr1 and arr2 */
243 UInt32* ptr;
244 UInt16* block;
245 UInt16* mtfv;
246 UChar* zbits;
247
248 /* for deciding when to use the fallback sorting algorithm */
249 Int32 workFactor;
250
245 /* run-length-encoding of the input */ 251 /* run-length-encoding of the input */
246 UInt32 state_in_ch; 252 UInt32 state_in_ch;
247 Int32 state_in_len; 253 Int32 state_in_len;
@@ -269,7 +275,6 @@ typedef
269 /* misc administratium */ 275 /* misc administratium */
270 Int32 verbosity; 276 Int32 verbosity;
271 Int32 blockNo; 277 Int32 blockNo;
272 Int32 nBlocksRandomised;
273 Int32 blockSize100k; 278 Int32 blockSize100k;
274 279
275 /* stuff for coding the MTF values */ 280 /* stuff for coding the MTF values */
@@ -478,17 +483,17 @@ typedef
478 } 483 }
479 484
480#define GET_LL4(i) \ 485#define GET_LL4(i) \
481 (((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4) & 0xF) 486 ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF)
482 487
483#define SET_LL(i,n) \ 488#define SET_LL(i,n) \
484 { s->ll16[i] = (UInt16)(n & 0x0000ffff); \ 489 { s->ll16[i] = (UInt16)(n & 0x0000ffff); \
485 SET_LL4(i, n >> 16); \ 490 SET_LL4(i, n >> 16); \
486 } 491 }
487 492
488#define GET_LL(i) \ 493#define GET_LL(i) \
489 (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) 494 (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16))
490 495
491#define BZ_GET_SMALL(cccc) \ 496#define BZ_GET_SMALL(cccc) \
492 cccc = indexIntoF ( s->tPos, s->cftab ); \ 497 cccc = indexIntoF ( s->tPos, s->cftab ); \
493 s->tPos = GET_LL(s->tPos); 498 s->tPos = GET_LL(s->tPos);
494 499