dthdr.h 996 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. /* Internal definitions for libcdt.
  3. ** Written by Kiem-Phong Vo (5/25/96)
  4. */
  5. #include <stdlib.h>
  6. #include <cdt.h>
  7. /* short-hand notations */
  8. #define left hl._left
  9. #define hash hl._hash
  10. #define htab hh._htab
  11. #define head hh._head
  12. /* this must be disjoint from DT_METHODS */
  13. #define DT_FLATTEN 010000 /* dictionary already flattened */
  14. #define DT_WALK 020000 /* hash table being walked */
  15. /* hash start size and load factor */
  16. #define HSLOT (256)
  17. #define HRESIZE(n) ((n) << 1)
  18. #define HLOAD(s) ((s) << 1)
  19. #define HINDEX(n,h) ((h)&((n)-1))
  20. #define UNFLATTEN(dt) \
  21. ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NULL) : 0)
  22. /* tree rotation/linking functions */
  23. #define rrotate(x,y) ((x)->left = (y)->right, (y)->right = (x))
  24. #define lrotate(x,y) ((x)->right = (y)->left, (y)->left = (x))
  25. #define rlink(r,x) ((r) = (r)->left = (x) )
  26. #define llink(l,x) ((l) = (l)->right = (x) )
  27. #define RROTATE(x,y) (rrotate(x,y), (x) = (y))
  28. #define LROTATE(x,y) (lrotate(x,y), (x) = (y))