bound.h 903 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Bounding Box stuff (brucee 04/03/30).
  3. */
  4. #include <mp.h>
  5. #include <libsec.h>
  6. typedef struct BB BB;
  7. typedef struct BBset BBset;
  8. typedef uchar Hval[SHA1dlen];
  9. #define BBEQ(a, b) (memcmp((a), (b), SHA1dlen) == 0)
  10. #define BBMKHASH(b, n, h) sha1((uchar *)(b), (n), (h), nil)
  11. #define BBCP(d, s) memmove(d, s, SHA1dlen)
  12. enum
  13. {
  14. Bpre = 1 << 0, /* has a flow in */
  15. Bjo = 1 << 1, /* a jump only */
  16. Bbig = 1 << 2, /* too big */
  17. Bdel = 1 << 3, /* deleted or not of interest */
  18. Bpin = 1 << 4, /* pinned by embedded labels */
  19. BBHASH = 64, /* power of 2 <= 256 */
  20. BBMASK = BBHASH - 1,
  21. BBINIT = 128,
  22. BBBIG = 64,
  23. BBBSIZE = 8192,
  24. BINST = 128,
  25. COSTHI = 0x7F,
  26. COSTJO = 0xFF,
  27. };
  28. struct BB
  29. {
  30. Reg* first;
  31. Reg* last;
  32. BBset* set;
  33. BB* link;
  34. BB* aux;
  35. short flags;
  36. short len;
  37. };
  38. struct BBset
  39. {
  40. Hval hash;
  41. BB* ents;
  42. BBset* next;
  43. BBset* link;
  44. short index;
  45. uchar damage;
  46. uchar recalc;
  47. };