summaryrefslogtreecommitdiff
path: root/sys/src/cmd/8c/bound.h
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/8c/bound.h
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/8c/bound.h')
-rwxr-xr-xsys/src/cmd/8c/bound.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/sys/src/cmd/8c/bound.h b/sys/src/cmd/8c/bound.h
new file mode 100755
index 000000000..796032d62
--- /dev/null
+++ b/sys/src/cmd/8c/bound.h
@@ -0,0 +1,56 @@
+/*
+ * 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;
+};