12 static void dthtab(
Dt_t* dt)
30 {
for(k = 2; k < n; k *= 2)
56 for(hs = s+n-1; hs >= olds; --hs)
58 for(hs = s; hs < olds; ++hs)
61 if((is = s +
HINDEX(n,t->hash)) == hs)
67 t->right = *is; *is = t;
73 static void* dthash(
Dt_t* dt,
reg void* obj,
int type)
102 if(!disc->freef && disc->link >= 0)
107 (*disc->freef)(dt,
_DTOBJ(t,lk),disc);
109 (*dt->
memoryf)(dt,(
void*)t,0,disc);
120 while(s < ends && !t )
121 t = (type&
DT_LAST) ? *--ends : *s++;
123 for(; t->right; t = t->right)
139 for(p =
NIL(
Dtlink_t*), t = *s; t; p = t, t = t->right)
153 hsh =
_DTHSH(dt,key,disc,sz);
170 { key =
_DTKEY(obj,ky,sz);
171 hsh =
_DTHSH(dt,key,disc,sz);
178 if(
_DTCMP(dt,key,k,disc,cmpf,sz) == 0)
207 !(obj = (*disc->makef)(dt,obj,disc)) )
217 {
if(disc->makef && disc->freef && (type&DT_INSERT))
218 (*disc->freef)(dt,obj,disc);
230 if(disc->freef && (type&DT_INSERT))
231 (*disc->freef)(dt,obj,disc);
233 (*disc->memoryf)(dt,(
void*)r,0,disc);
238 { r->right = t->right;
249 {
if(t && !(p = t->right) )
250 {
for(ends = dt->
data->htab+dt->
data->
ntab, s += 1; s < ends; ++s)
259 {
while(p->right != t)
264 for(s -= 1, ends = dt->
data->htab; s >= ends; --s)
292 (*disc->freef)(dt,obj,disc);
294 (*dt->
memoryf)(dt,(
void*)r,0,disc);
305 else if((p = *s) == t)
308 {
while(p->right != t)
316 (*disc->freef)(dt,obj,disc);
318 (*dt->
memoryf)(dt,(
void*)t,0,disc);
int(* Dtcompar_f)(Dt_t *, void *, void *, Dtdisc_t *)
CDT_API Dtmethod_t * Dtbag
#define _DTHSH(dt, ky, dc, sz)
CDT_API Dtmethod_t _Dthash
CDT_API Dtmethod_t * Dtset
#define _DTDSC(dc, ky, sz, lk, cmpf)
#define _DTCMP(dt, k1, k2, dc, cmpf, sz)
struct _dthold_s Dthold_t
CDT_API Dtmethod_t * Dthash
#define _DTKEY(o, ky, sz)