Skip to content

Commit

Permalink
u3: refactors +cap jet
Browse files Browse the repository at this point in the history
  • Loading branch information
joemfb committed Oct 14, 2023
1 parent b58e4c7 commit 562bfac
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions pkg/noun/jets/c/cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,21 @@

#include "noun.h"

u3_noun
u3qc_cap(u3_atom a)
{
c3_w met_w = u3r_met(0, a);

u3_noun
u3qc_cap(u3_atom a)
{
c3_w met_w = u3r_met(0, a);

if ( met_w < 2 ) {
return u3m_bail(c3__exit);
}
else if ( (1 == u3r_bit((met_w - 2), a)) ) {
return 3;
} else {
return 2;
}
if ( 2 > met_w ) {
return u3m_bail(c3__exit);
}
u3_noun
u3wc_cap(u3_noun cor)
{
u3_noun a;

if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ||
(c3n == u3ud(a)) )
{
return u3m_bail(c3__exit);
} else {
return u3qc_cap(a);
}
else {
return 2 + u3r_bit((met_w - 2), a);
}
}

u3_noun
u3wc_cap(u3_noun cor)
{
return u3qc_cap(u3x_atom(u3x_at(u3x_sam, cor)));
}

0 comments on commit 562bfac

Please sign in to comment.