Appendix i decompression source code – Intel Extensible Firmware Interface User Manual

Page 993

Advertising
background image

Version 1.10

12/01/02

I-1

Appendix I

Decompression Source Code

/*++

Copyright (c) 2001–2002 Intel Corporation

Module Name:

Decompress.c

Abstract:

Decompressor.

--*/

#include "EfiCommon.h"


#define BITBUFSIZ 16
#define WNDBIT 13
#define WNDSIZ (1U << WNDBIT)
#define MAXMATCH 256
#define THRESHOLD 3
#define CODE_BIT 16
#define UINT8_MAX 0xff
#define BAD_TABLE -1

//
// C: Char&Len Set; P: Position Set; T: exTra Set
//

#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
#define CBIT 9
#define NP (WNDBIT + 1)
#define NT (CODE_BIT + 3)
#define PBIT 4
#define TBIT 5
#if NT > NP
#define NPT NT
#else
#define NPT NP
#endif


typedef struct {
UINT8 *mSrcBase; //Starting address of compressed data
UINT8 *mDstBase; //Starting address of decompressed data

UINT16 mBytesRemain;
UINT16 mBitCount;
UINT16 mBitBuf;
UINT16 mSubBitBuf;
UINT16 mBufSiz;
UINT16 mBlockSize;

Advertising