NT4/private/windows/win4help/winhelp/inc/zeckdat.h
2020-09-30 17:12:29 +02:00

43 lines
1.5 KiB
C

/*****************************************************************************
* *
* ZECKDAT.H *
* *
* Copyright (C) Microsoft Corporation 1990. *
* All Rights reserved. *
* *
******************************************************************************
* *
* Module Intent *
* *
* Internal data decls for Zeck compression routines for bitmaps & topic
* 2K blocks.
* *
*****************************************************************************/
/* ----- THIS STUFF USED INTERNALLY BY THE COMPRESSION ROUTINES ----- */
// this bitfields structure encodes an offset and a length of the
// repeated pattern. Since we deal with huge buffers, we must access
// this as two bytes to insert it into the buffer (structures cannot
// cross huge segment boundaries).
typedef union bytesoverlay {
struct {
UINT16 uiBackwardsOffset:12;
UINT16 cbPatternLen:4;
};
BYTE bytes[2];
} ZECKPACKBLOCK, *QZECKPACKBLOCK;
// The length encoding is offset by a min value since you would never
// encode a pattern of 1 or 2 bytes:
#define MIN_PATTERN_LEN 3
#define MAX_PATTERN_LEN 18
#define PATTERNLEN_FROM_ENCODE(len) ((len) + MIN_PATTERN_LEN)
#define ENCODE_FROM_PATTERNLEN(len) ((len) -MIN_PATTERN_LEN)
// do similar offset for backwards offset:
#define BACKWARDS_FROM_ENCODE(offset) ((offset) + 1)
#define ENCODE_FROM_BACKWARDS(offset) ((offset) -1)