Don't need to initialize indices for hashed Index-of
This commit is contained in:
parent
1286ee32ec
commit
af81da50e4
@ -50,6 +50,7 @@ def hash_alloc{logsz, msz, ext, Ts, v0s} = {
|
|||||||
def pe{{..._, p}} = p+sze # Next unallocated space given pointers so far
|
def pe{{..._, p}} = p+sze # Next unallocated space given pointers so far
|
||||||
def pl{{...R, T}} = { def ps=pl{R}; tup{...ps, *T~~pe{ps}+szo} }
|
def pl{{...R, T}} = { def ps=pl{R}; tup{...ps, *T~~pe{ps}+szo} }
|
||||||
ptrs := pl{Ts}
|
ptrs := pl{Ts}
|
||||||
|
def memset{_, ('any'), _} = {} # Indicates initialization not needed
|
||||||
each{memset{., ., sze}, ptrs, v0s}
|
each{memset{., ., sze}, ptrs, v0s}
|
||||||
|
|
||||||
def hash_resize{cc, m} = {
|
def hash_resize{cc, m} = {
|
||||||
@ -66,7 +67,10 @@ def hash_alloc{logsz, msz, ext, Ts, v0s} = {
|
|||||||
k0 := h>>sh; k := k0; while (hash->k!=h0) ++k
|
k0 := h>>sh; k := k0; while (hash->k!=h0) ++k
|
||||||
cc += cast_i{usz, k-k0}
|
cc += cast_i{usz, k-k0}
|
||||||
hash <-{k} h
|
hash <-{k} h
|
||||||
each{{p,v0} => { v := p->j; p <-{j} v0; p <-{k} v }, vals, v0r}
|
def move{p,v0} = {
|
||||||
|
v := p->j; if (not same{v0,'any'}) p <-{j} v0; p <-{k} v
|
||||||
|
}
|
||||||
|
each{move, vals, v0r}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -360,7 +360,7 @@ fn hashtab{T, name}(rp:*rty{name}, ip:*T, m:usz, fp:*T, n:usz, links:ity{name})
|
|||||||
maxh := T~~maxvalue{T}
|
maxh := T~~maxvalue{T}
|
||||||
def aux = prim!='∊'
|
def aux = prim!='∊'
|
||||||
def {tabs, sz, sh, hash_resize, hash_free} = hash_alloc{
|
def {tabs, sz, sh, hash_resize, hash_free} = hash_alloc{
|
||||||
sl, msz, ext, tup{T, ...aux**u32}, tup{maxh, ...aux**0}
|
sl, msz, ext, tup{T, ...aux**u32}, tup{maxh, ...aux**(if (prim=='⊐') 'any' else 0)}
|
||||||
}
|
}
|
||||||
def {hash,...vals} = tabs
|
def {hash,...vals} = tabs
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user