u3: removes obsolete u3h_gut()

This commit is contained in:
Joe Bryan 2019-09-19 17:18:15 -07:00
parent 8b985fccfc
commit a0a0c91ad3
3 changed files with 2 additions and 105 deletions

View File

@ -124,13 +124,6 @@
u3_weak
u3h_git(u3p(u3h_root) har_p, u3_noun key);
/* u3h_gut(): read from hashtable, unifying key nouns.
**
** `key` is RETAINED.
*/
u3_weak
u3h_gut(u3p(u3h_root) har_p, u3_noun key);
/* u3h_trim_to(): trim to n key-value pairs
*/
void

View File

@ -626,102 +626,6 @@ u3h_get(u3p(u3h_root) har_p, u3_noun key)
return pro;
}
/* _ch_buck_gut(): read in bucket, unifying key nouns.
*/
static u3_weak
_ch_buck_gut(u3h_buck* hab_u, u3_noun key)
{
c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
u3_noun kev = u3h_slot_to_noun(hab_u->sot_w[i_w]);
if ( _(u3r_sing(key, u3h(kev))) ) {
return u3t(kev);
}
}
return u3_none;
}
/* _ch_node_gut(): read in node, unifying key nouns.
*/
static u3_weak
_ch_node_gut(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key)
{
c3_w bit_w, map_w;
lef_w -= 5;
bit_w = (rem_w >> lef_w);
rem_w = CUT_END(rem_w, lef_w);
map_w = han_u->map_w;
if ( !BIT_SET(map_w, bit_w) ) {
return u3_none;
}
else {
c3_w inx_w = _ch_popcount(CUT_END(map_w, bit_w));
c3_w sot_w = han_u->sot_w[inx_w];
if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3h_slot_to_noun(sot_w);
if ( _(u3r_sing(key, u3h(kev))) ) {
return u3t(kev);
}
else {
return u3_none;
}
}
else {
void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) {
return _ch_buck_gut(hav_v, key);
}
else return _ch_node_gut(hav_v, lef_w, rem_w, key);
}
}
}
/* u3h_gut(): read from hashtable, unifying key nouns.
**
** `key` is RETAINED.
*/
u3_weak
u3h_gut(u3p(u3h_root) har_p, u3_noun key)
{
u3h_root* har_u = u3to(u3h_root, har_p);
c3_w mug_w = u3r_mug(key);
c3_w inx_w = (mug_w >> 25);
c3_w rem_w = CUT_END(mug_w, 25);
c3_w sot_w = har_u->sot_w[inx_w];
if ( _(u3h_slot_is_null(sot_w)) ) {
return u3_none;
}
else if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3h_slot_to_noun(sot_w);
if ( _(u3r_sing(key, u3h(kev))) ) {
har_u->sot_w[inx_w] = u3h_noun_be_warm(sot_w);
return u3k(u3t(kev));
}
else {
return u3_none;
}
}
else {
u3h_node* han_u = u3h_slot_to_node(sot_w);
u3_weak pro = _ch_node_gut(han_u, 25, rem_w, key);
if ( u3_none == pro ) {
return u3_none;
}
else {
return u3k(pro);
}
}
}
/* _ch_free_buck(): free bucket
*/
static void

View File

@ -486,7 +486,7 @@ _cj_find_cold(u3_noun bat)
u3a_road* rod_u = u3R;
while ( 1 ) {
u3_weak bar = u3h_gut(rod_u->jed.cod_p, bat);
u3_weak bar = u3h_get(rod_u->jed.cod_p, bat);
if ( u3_none != bar ) {
return bar;
@ -508,7 +508,7 @@ _cj_find_warm(u3_noun loc)
u3a_road* rod_u = u3R;
while ( 1 ) {
u3_weak ank = u3h_gut(rod_u->jed.war_p, loc);
u3_weak ank = u3h_get(rod_u->jed.war_p, loc);
if ( u3_none != ank ) {
return ank;