📄 lzrw3.h
字号:
/* > If the previous fact is true, the following facts must also be true: *//* > src_len will be in the range [0,COMPRESS_MAX_COM]. *//* > dst_len will be in the range [0,COMPRESS_MAX_ORG]. *//* > The input and output blocks must not overlap. *//* > Only the output block is modified. *//* > Upon termination, the output block will consist of the bytes contained *//* in the input block passed to the earlier compression operation. *//* *//******************************************************************************//******************************************************************************//* *//* PORT.H *//* *//******************************************************************************//* *//* This module contains macro definitions and types that are likely to *//* change between computers. *//* *//******************************************************************************/#ifndef DONE_PORT /* Only do this if not previously done. */ #ifdef THINK_C #define UBYTE unsigned char /* Unsigned byte */ #define UWORD unsigned int /* Unsigned word (2 bytes) */ #define ULONG unsigned long /* Unsigned word (4 bytes) */ #define BOOL unsigned char /* Boolean */ #define FOPEN_BINARY_READ "rb" /* Mode string for binary reading. */ #define FOPEN_BINARY_WRITE "wb" /* Mode string for binary writing. */ #define FOPEN_TEXT_APPEND "a" /* Mode string for text appending. */ #define REAL double /* USed for floating point stuff. */ #endif #if defined(LINUX) || defined(linux) #define UBYTE __u8 /* Unsigned byte */ #define UWORD __u16 /* Unsigned word (2 bytes) */ #define ULONG __u32 /* Unsigned word (4 bytes) */ #define LONG __s32 /* Signed word (4 bytes) */ #define BOOL is not used here /* Boolean */ #define FOPEN_BINARY_READ not used /* Mode string for binary reading. */ #define FOPEN_BINARY_WRITE not used /* Mode string for binary writing. */ #define FOPEN_TEXT_APPEND not used /* Mode string for text appending. */ #define REAL not used /* USed for floating point stuff. */ #ifndef TRUE #define TRUE 1 #endif #endif #define DONE_PORT /* Don't do all this again. */ #define MALLOC_FAIL NULL /* Failure status from malloc() */ #define LOCAL static /* For non-exported routines. */ #define EXPORT /* Signals exported function. */ #define then /* Useful for aligning ifs. */#endif/******************************************************************************//* End of PORT.H *//******************************************************************************/#define COMPRESS_ACTION_IDENTITY 0#define COMPRESS_ACTION_COMPRESS 1#define COMPRESS_ACTION_DECOMPRESS 2#define COMPRESS_OVERRUN 1024#define COMPRESS_MAX_COM 0x70000000#define COMPRESS_MAX_ORG (COMPRESS_MAX_COM-COMPRESS_OVERRUN)#define COMPRESS_MAX_STRLEN 255/* The following structure provides information about the algorithm. *//* > The top bit of id must be zero. The remaining bits must be chosen by *//* the author of the algorithm by tossing a coin 31 times. *//* > The amount of memory requested by the algorithm is specified in bytes *//* and must be in the range [0,0x70000000]. *//* > All strings s must be such that strlen(s)<=COMPRESS_MAX_STRLEN. */struct compress_identity { ULONG id; /* Identifying number of algorithm. */ ULONG memory; /* Number of bytes of working memory required. */ char *name; /* Name of algorithm. */ char *version; /* Version number. */ char *date; /* Date of release of this version. */ char *copyright; /* Copyright message. */ char *author; /* Author of algorithm. */ char *affiliation; /* Affiliation of author. */ char *vendor; /* Where the algorithm can be obtained. */ };void lzrw3_compress( /* Single function interface to compression algorithm. */UWORD action, /* Action to be performed. */UBYTE *wrk_mem, /* Working memory temporarily given to routine to use. */UBYTE *src_adr, /* Address of input data. */LONG src_len, /* Length of input data. */UBYTE *dst_adr, /* Address of output data. */void *p_dst_len /* Pointer to a longword where routine will write: */ /* If action=..IDENTITY => Adr of id structure. */ /* If action=..COMPRESS => Length of output data. */ /* If action=..DECOMPRESS => Length of output data. */);/******************************************************************************//* End of COMPRESS.H *//******************************************************************************//******************************************************************************//* fast_copy.h *//******************************************************************************//* This function copies a block of memory very quickly. *//* The exact speed depends on the relative alignment of the blocks of memory. *//* PRE : 0<=src_len<=(2^32)-1 . *//* PRE : Source and destination blocks must not overlap. *//* POST : MEM[dst_adr,dst_adr+src_len-1]=MEM[src_adr,src_adr+src_len-1]. *//* POST : MEM[dst_adr,dst_adr+src_len-1] is the only memory changed. */#define fast_copy(src,dst,len) memcpy(dst,src,len)/******************************************************************************//* End of fast_copy.h *//******************************************************************************/#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -