1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
28 /* Internal definitions for libcdt.
29 ** Written by Kiem-Phong Vo (5/25/96)
38 /* short-hand notations */
41 #define uint unsigned int
47 /* this must be disjoint from DT_METHODS */
48 #define DT_FLATTEN 010000 /* dictionary already flattened */
49 #define DT_WALK 020000 /* hash table being walked */
51 /* how the Dt_t handle was allocated */
55 /* max search length before splaying */
56 #define DT_MINP (sizeof(size_t)*8 - 2)
58 /* hash start size and load factor */
60 #define HRESIZE(n) ((n) << 1)
61 #define HLOAD(s) ((s) << 1)
62 #define HINDEX(n,h) ((h)&((n)-1))
64 #define UNFLATTEN(dt) \
65 ((dt->data->type&DT_FLATTEN) ? dtrestore(dt,NIL(Dtlink_t*)) : 0)
67 /* tree rotation/linking functions */
68 #define rrotate(x,y) ((x)->left = (y)->right, (y)->right = (x))
69 #define lrotate(x,y) ((x)->right = (y)->left, (y)->left = (x))
70 #define rlink(r,x) ((r) = (r)->left = (x) )
71 #define llink(l,x) ((l) = (l)->right = (x) )
73 #define RROTATE(x,y) (rrotate(x,y), (x) = (y))
74 #define LROTATE(x,y) (lrotate(x,y), (x) = (y))
78 extern Void_t
* malloc
_ARG_((size_t));
79 extern Void_t
* realloc
_ARG_((Void_t
*, size_t));
80 extern void free
_ARG_((Void_t
*));