Merge branch 'lune-jet'

Add a jet for ++lune. The jetted algorithm walks the cord backwards, and
should be slightly more performant than jetted ++lore for this reason.
This commit is contained in:
Raymond Pasco 2016-03-03 00:07:11 -05:00
commit b16a7ee93d
5 changed files with 52 additions and 0 deletions

View File

@ -262,6 +262,7 @@ J_E_OFILES=\
jets/e/shax.o \ jets/e/shax.o \
jets/e/lore.o \ jets/e/lore.o \
jets/e/loss.o \ jets/e/loss.o \
jets/e/lune.o \
jets/e/trip.o jets/e/trip.o
J_E_OFILES_ED=\ J_E_OFILES_ED=\

View File

@ -97,6 +97,7 @@
u3_noun u3qe_rub(u3_atom, u3_atom); u3_noun u3qe_rub(u3_atom, u3_atom);
u3_noun u3qe_lore(u3_atom); u3_noun u3qe_lore(u3_atom);
u3_noun u3qe_loss(u3_noun, u3_noun); u3_noun u3qe_loss(u3_noun, u3_noun);
u3_noun u3qe_lune(u3_atom);
u3_noun u3qe_repg(u3_noun, u3_noun, u3_noun); u3_noun u3qe_repg(u3_noun, u3_noun, u3_noun);
u3_noun u3qe_rexp(u3_noun, u3_noun); u3_noun u3qe_rexp(u3_noun, u3_noun);
u3_noun u3qe_trip(u3_atom); u3_noun u3qe_trip(u3_atom);

View File

@ -102,6 +102,7 @@
u3_noun u3we_rub(u3_noun); u3_noun u3we_rub(u3_noun);
u3_noun u3we_lore(u3_noun); u3_noun u3we_lore(u3_noun);
u3_noun u3we_loss(u3_noun); u3_noun u3we_loss(u3_noun);
u3_noun u3we_lune(u3_noun);
u3_noun u3we_mink(u3_noun); u3_noun u3we_mink(u3_noun);
u3_noun u3we_mule(u3_noun); u3_noun u3we_mule(u3_noun);
u3_noun u3we_repg(u3_noun); u3_noun u3we_repg(u3_noun);

47
jets/e/lune.c Normal file
View File

@ -0,0 +1,47 @@
/* j/5/lune.c
**
*/
#include "all.h"
u3_noun
u3qe_lune(u3_atom lub)
{
if (lub == 0) {
return u3_nul;
}
{
c3_w end_w = u3r_met(3, lub) - 1;
c3_w pos_w = end_w;
u3_noun lin = u3_nul;
if (u3r_byte(pos_w, lub) != 10) {
return u3m_error("noeol");
}
while (--pos_w) {
if (u3r_byte(pos_w, lub) == 10) {
lin = u3nc(u3qc_cut(3, (pos_w + 1), (end_w - pos_w - 1), lub), lin);
end_w = pos_w;
continue;
}
}
return u3nc(u3qc_cut(3, pos_w, (end_w - pos_w), lub), lin);
}
}
u3_noun
u3we_lune(u3_noun cor)
{
u3_noun lub;
if ( (u3_none == (lub = u3r_at(u3x_sam, cor))) ||
(c3n == u3ud(lub)) )
{
return u3m_bail(c3__fail);
} else {
return u3qe_lune(lub);
}
}

View File

@ -124,6 +124,7 @@ static u3j_harm _mood__hoon_mat_a[] = {{".2", u3we_mat}, {}};
static u3j_harm _mood__hoon_rub_a[] = {{".2", u3we_rub}, {}}; static u3j_harm _mood__hoon_rub_a[] = {{".2", u3we_rub}, {}};
static u3j_harm _mood__hoon_lore_a[] = {{".2", u3we_lore}, {}}; static u3j_harm _mood__hoon_lore_a[] = {{".2", u3we_lore}, {}};
static u3j_harm _mood__hoon_loss_a[] = {{".2", u3we_loss}, {}}; static u3j_harm _mood__hoon_loss_a[] = {{".2", u3we_loss}, {}};
static u3j_harm _mood__hoon_lune_a[] = {{".2", u3we_lune}, {}};
static u3j_harm _mood__hoon_mink_a[] = {{".2", u3we_mink}, {}}; static u3j_harm _mood__hoon_mink_a[] = {{".2", u3we_mink}, {}};
static u3j_harm _mood__hoon_mule_a[] = {{".2", u3we_mule}, {}}; static u3j_harm _mood__hoon_mule_a[] = {{".2", u3we_mule}, {}};
static u3j_harm _mood__hoon_repg_a[] = {{".2", u3we_repg}, {}}; static u3j_harm _mood__hoon_repg_a[] = {{".2", u3we_repg}, {}};
@ -484,6 +485,7 @@ static u3j_core _mood__hoon_d[] =
{ "rub", _mood__hoon_rub_a }, { "rub", _mood__hoon_rub_a },
{ "lore", _mood__hoon_lore_a }, { "lore", _mood__hoon_lore_a },
{ "loss", _mood__hoon_loss_a }, { "loss", _mood__hoon_loss_a },
{ "lune", _mood__hoon_lune_a },
{ "mink", _mood__hoon_mink_a }, { "mink", _mood__hoon_mink_a },
{ "mule", _mood__hoon_mule_a }, { "mule", _mood__hoon_mule_a },
{ "repg", _mood__hoon_repg_a }, { "repg", _mood__hoon_repg_a },