Plan 9 from Bell Labs’s /usr/web/sources/contrib/boyd/sys/src/cmd/8c/bound.h

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


/*
 *	Bounding Box stuff (brucee 04/03/30).
 */

#include <mp.h>
#include <libsec.h>

typedef	struct	BB	BB;
typedef	struct	BBset	BBset;
typedef uchar		Hval[SHA1dlen];

#define	BBEQ(a, b)		(memcmp((a), (b), SHA1dlen) == 0)
#define	BBMKHASH(b, n, h)	sha1((uchar *)(b), (n), (h), nil)
#define	BBCP(d, s)		memmove(d, s, SHA1dlen)

enum
{
	Bpre	= 1 << 0,	/* has a flow in */
	Bjo	= 1 << 1,	/* a jump only */
	Bbig	= 1 << 2,	/* too big */
	Bdel	= 1 << 3,	/* deleted or not of interest */
	Bpin	= 1 << 4,	/* pinned by embedded labels */

	BBHASH	= 64,		/* power of 2 <= 256 */
	BBMASK	= BBHASH - 1,

	BBINIT	= 128,
	BBBIG	= 64,
	BBBSIZE	= 8192,
	BINST	= 128,

	COSTHI	= 0x7F,
	COSTJO	= 0xFF,
};

struct	BB
{
	Reg*	first;
	Reg*	last;
	BBset*	set;
	BB*	link;
	BB*	aux;
	short	flags;
	short	len;
};

struct	BBset
{
	Hval	hash;
	BB*	ents;
	BBset*	next;
	BBset*	link;
	short	index;
	uchar	damage;
	uchar	recalc;
};

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.