Skip to content

Commit

Permalink
u3: further optimizes u3i_edit, inlining axis bit math
Browse files Browse the repository at this point in the history
  • Loading branch information
joemfb committed May 1, 2023
1 parent dcda46f commit bec84ac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/noun/imprison.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,15 @@ u3i_edit(u3_noun big, u3_noun axe, u3_noun som)
case 1: break;

default: {
c3_w dep_w = u3r_met(0, u3x_atom(axe)) - 2;
c3_w dep_w = u3r_met(0, u3x_atom(axe)) - 2;
const c3_w* axe_w = ( c3y == u3a_is_cat(axe) )
? &axe
: ((u3a_atom*)u3a_to_ptr(axe))->buf_w;

do {
u3a_cell* big_u = u3a_to_ptr(big);
u3_noun* old = (u3_noun*)&(big_u->hed);
const c3_y bit_y = u3r_bit(dep_w, axe);
const c3_y bit_y = 1 & (axe_w[dep_w >> 5] >> (dep_w & 31));

if ( c3n == u3a_is_cell(big) ) {
return u3m_bail(c3__exit);
Expand Down

0 comments on commit bec84ac

Please sign in to comment.