Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/port/thwack.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname port/thwack.h 1999/1001
## diff -e /dev/null /n/emeliedump/1999/1001/sys/src/brazil/port/thwack.h
0a
typedef struct Thwack		Thwack;
typedef struct Unthwack		Unthwack;
typedef struct ThwBlock		ThwBlock;
typedef struct UnthwBlock	UnthwBlock;

enum
{
	ThwMaxBlock	= 1600,		/* max size of compressible block */

	MinMatch	= 3,		/* shortest match possible */
	HashLog		= 10,
	HashSize	= 1<<HashLog,
	HashMask	= HashSize - 1,

	MaxLen		= 8,
	MaxOff		= 8,
	OffBase		= 6,

	MinDecode	= 9,		/* minimum bits to decode a match or lit */

	EWinBlocks	= 32,		/* blocks held in encoder window */
	DWinBlocks	= 32,		/* blocks held in decoder window */
	CompBlocks	= 5,		/* max blocks used to encode data */

	MaxSeqMask	= 8,		/* number of bits in coding block mask */
	MaxSeqStart	= 256,		/* max offset of initial coding block */
};

struct ThwBlock
{
	ulong	seq;			/* sequence number for this data */
	uchar	acked;			/* ok to use this block; the decoder has it */
	ushort	begin;			/* time of first byte in hash */
	uchar	*edata;			/* last byte of valid data */
	ushort	maxoff;			/* time of last valid hash entry */
	ushort	*hash;
	uchar	*data;
};

struct Thwack
{
	ulong		nbits;		/* output bit buffer */
	ulong		bits;
	uchar		*dst;		/* output buffer */
	uchar		*dmax;

	ulong		slot;		/* next block to use */
	ThwBlock	blocks[EWinBlocks];
	ushort		hash[EWinBlocks][HashSize];
	uchar		data[EWinBlocks][ThwMaxBlock];
};

struct UnthwBlock
{
	ulong	seq;			/* sequence number for this data */
	ushort	maxoff;			/* valid data in each block */
	uchar	*data;
};

struct Unthwack
{
	ulong		nbits;		/* input bit buffer */
	ulong		bits;
	uchar		*src;		/* input buffer */
	uchar		*smax;

	int		slot;		/* next block to use */
	UnthwBlock	blocks[DWinBlocks];
	uchar		data[DWinBlocks][ThwMaxBlock];
};

void	thwackinit(Thwack*);
void	unthwackinit(Unthwack*);
int	thwack(Thwack*, uchar *dst, uchar *src, int nsrc, ulong seq);
void	thwackack(Thwack*, ulong seq, ulong mask);
int	unthwack(Unthwack*, uchar *dst, int ndst, uchar *src, int nsrc, ulong seq);
.
## diffname port/thwack.h 1999/1007
## diff -e /n/emeliedump/1999/1001/sys/src/brazil/port/thwack.h /n/emeliedump/1999/1007/sys/src/brazil/port/thwack.h
62,66d
47c
	int		slot;		/* next block to use */
.
19a
	MaxOffDecode	= 4 + MaxOff + OffBase - 1,
	MaxLenDecode	= 16,
.
15c
	MaxFastLen	= 9,
	BigLenCode	= 0xf4,		/* minimum code for large lenth encoding */
	BigLenBase	= 4,		/* starting items to encode for big lens */
	BigLenBits	= 8,
.
## diffname port/thwack.h 1999/1022
## diff -e /n/emeliedump/1999/1007/sys/src/brazil/port/thwack.h /n/emeliedump/1999/1022/sys/src/brazil/port/thwack.h
74c
int	thwack(Thwack*, uchar *dst, uchar *src, int nsrc, ulong seq, ulong stats[ThwStats]);
.
47,51d
31c
	MaxSeqStart	= 256		/* max offset of initial coding block */
.
22c
	MinDecode	= 8,		/* minimum bits to decode a match or lit; >= 8 */
.
11c
	HashLog		= 12,
.
7a
	ThwStats	= 8,
.
## diffname port/thwack.h 1999/1111
## diff -e /n/emeliedump/1999/1022/sys/src/brazil/port/thwack.h /n/emeliedump/1999/1111/sys/src/9/port/thwack.h
72a
int	unthwackadd(Unthwack*, uchar *src, int nsrc, ulong seq);
.
29c
	CompBlocks	= 10,		/* max blocks used to encode data */
.
24,25d
16,19c
	MinMatch	= 3,		/* shortest match possible */

.
11d
## diffname port/thwack.h 1999/1116
## diff -e /n/emeliedump/1999/1111/sys/src/9/port/thwack.h /n/emeliedump/1999/1116/sys/src/9/port/thwack.h
68d
## diffname port/thwack.h 2001/0213
## diff -e /n/emeliedump/1999/1116/sys/src/9/port/thwack.h /n/emeliedump/2001/0213/sys/src/9/port/thwack.h
22c
	EWinBlocks	= 22,		/* blocks held in encoder window */
.
## diffname port/thwack.h 2001/0214
## diff -e /n/emeliedump/2001/0213/sys/src/9/port/thwack.h /n/emeliedump/2001/0214/sys/src/9/port/thwack.h
67a
ulong	unthwackstate(Unthwack *ut, uchar *mask);
.
## diffname port/thwack.h 2001/0527
## diff -e /n/emeliedump/2001/0214/sys/src/9/port/thwack.h /n/emeliedump/2001/0527/sys/src/9/port/thwack.h
68d
22c
	EWinBlocks	= 32,		/* blocks held in encoder window */
.
## diffname port/thwack.h 2001/1011
## diff -e /n/emeliedump/2001/0527/sys/src/9/port/thwack.h /n/emeliedump/2001/1011/sys/src/9/port/thwack.h
67a
ulong	unthwackstate(Unthwack *ut, uchar *mask);
.
22c
	EWinBlocks	= 22,		/* blocks held in encoder window */
.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].