/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1996-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Phong Vo <kpv@research.att.com> *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
/* Radix + splay tree
** Strategy:
** 1. Records are partitioned by first bytes.
** 2. Short records are sorted by a radix sort.
** 3. Long records are sorted in splay trees.
** 4. A final merge phase put things back together.
**
** Written by Kiem-Phong Vo (07/08/96).
*/
#include "rshdr.h"
typedef struct rsrasp_s
} Rsrasp_t;
else \
else if((cr = (int)*o++ - (int)*t++)) break; \
} \
} \
}
#if __STD_C
#else
#endif
{
return 0;
}
if(cr == 1)
return 0;
}
return 0;
}
#if SIZEOF_LONG == 8
#else /* sizeof(long) == 4 */
#endif
return 0;
}
if(cr == 0)
return 0;
}
for(l = r = &link;; )
{ if(cr < 0)
if(cr < 0)
goto no_root;
}
else if(cr == 0)
goto has_root;
}
else
{ LLINK(l,t);
goto no_root;
}
}
else
goto no_root;
}
}
else /*if(cr > 0)*/
if(cr > 0)
goto no_root;
}
else if(cr == 0)
goto has_root;
}
else
{ RLINK(r,t);
goto no_root;
}
}
else
goto no_root;
}
}
if(cr == 0)
goto has_root;
}
return 0;
return 0;
}
#if __STD_C
#else
#endif
{
if(!(r = *bin) )
n += 1;
}
}
if(list)
{ if((r = *bin) )
{ n -= 1;
}
}
}
else
if((r = *bin) )
else
n += 1;
}
}
ph += 1;
{ if((r = *bin) )
{ n -= 1;
t->right = r;
t = r->left;
}
}
}
{ if(list)
break;
}
}
}
return list;
}
{ for(i = 2; i <= n; ++i) \
break; \
} \
}
#if __STD_C
#else
reg int n; /* number of bytes to compare */
#endif
{
reg int v, i;
if(v <= 0)
}
else
}
{ for(;;)
if(v <= 0)
else break;
}
else
else break;
}
}
}
if(one)
}
else if(two)
}
return list;
}
#if __STD_C
#else
#endif
/* find smallest element and make it head of list */
while((t = r->left) )
RROTATE(r,t);
/* flatten tree */
{ if(!r)
return list;
}
else if((t = r->left) )
{ do RROTATE(r,t);
while((t = r->left) );
p->right = r;
}
}
}
#if __STD_C
#else
#endif
{
reg int n, e;
{
{ t = flatten(r);
}
for(e = SLOT-1; e > 0; --e)
continue;
r = radix(r);
t = t ? listmerge(r,t,e) : r;
}
{ if((r->right = t) )
else r->left = r;
t = r;
}
if(t)
{ if(list)
else list = t;
}
}
if(list)
}
return list;
}
/* public method */
{ raspinsert,
sizeof(Rsrasp_t),
"rasp",
"Initial radix split into a forest of splay trees."
};
#ifdef NoF
#endif