++rd jets

This commit is contained in:
Max G 2015-07-29 06:56:02 +03:00
parent 65cd0f6e0c
commit 05e6a96bd5
5 changed files with 206 additions and 113 deletions

View File

@ -86,6 +86,7 @@ CFLAGS= $(COSFLAGS) -O3 -msse3 -ffast-math \
-Ioutside/commonmark/src \ -Ioutside/commonmark/src \
-Ioutside/commonmark/build/src \ -Ioutside/commonmark/build/src \
-Ioutside/scrypt \ -Ioutside/scrypt \
-Ioutside/softfloat-3/source/include \
$(DEFINES) \ $(DEFINES) \
$(MDEFINES) $(MDEFINES)
@ -364,6 +365,8 @@ LIBCOMMONMARK=outside/commonmark/build/src/libcmark.a
LIBSCRYPT=outside/scrypt/scrypt.a LIBSCRYPT=outside/scrypt/scrypt.a
LIBSOFTFLOAT=outside/softfloat-3/build/Linux-386-GCC/softfloat.a
all: urbit all: urbit
.MAKEFILE-VERSION: Makefile .make.conf .MAKEFILE-VERSION: Makefile .make.conf
@ -412,25 +415,28 @@ $(LIBCOMMONMARK):
$(LIBSCRYPT): $(LIBSCRYPT):
$(MAKE) -C outside/scrypt MDEFINES="$(MDEFINES)" $(MAKE) -C outside/scrypt MDEFINES="$(MDEFINES)"
$(LIBSOFTFLOAT):
$(MAKE) -C outside/softfloat-3/build/Linux-386-GCC
$(CRE2_OFILES): outside/cre2/src/src/cre2.cpp outside/cre2/src/src/cre2.h $(LIBRE2) $(CRE2_OFILES): outside/cre2/src/src/cre2.cpp outside/cre2/src/src/cre2.h $(LIBRE2)
$(CXX) $(CXXFLAGS) -c $< -o $@ $(CXX) $(CXXFLAGS) -c $< -o $@
$(V_OFILES): include/vere/vere.h $(V_OFILES): include/vere/vere.h
ifdef NO_SILENT_RULES ifdef NO_SILENT_RULES
$(BIN)/urbit: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT) $(BIN)/urbit: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT) $(LIBSOFTFLOAT)
mkdir -p $(BIN) mkdir -p $(BIN)
$(CLD) $(CLDOSFLAGS) -o $(BIN)/urbit $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT) $(CLD) $(CLDOSFLAGS) -o $(BIN)/urbit $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT) $(LIBSOFTFLOAT)
else else
$(BIN)/urbit: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT) $(BIN)/urbit: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT) $(LIBSOFTFLOAT)
@echo " CCLD $(BIN)/urbit" @echo " CCLD $(BIN)/urbit"
@mkdir -p $(BIN) @mkdir -p $(BIN)
@$(CLD) $(CLDOSFLAGS) -o $(BIN)/urbit $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT) @$(CLD) $(CLDOSFLAGS) -o $(BIN)/urbit $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT) $(LIBSOFTFLOAT)
endif endif
$(BIN)/meme: $(LIBCRE) $(LIBCOMMONMARK) $(MEME_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT) $(BIN)/meme: $(LIBCRE) $(LIBCOMMONMARK) $(MEME_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT) $(LIBSOFTFLOAT)
mkdir -p $(BIN) mkdir -p $(BIN)
$(CLD) $(CLDOSFLAGS) -o $(BIN)/meme $(MEME_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT) $(CLD) $(CLDOSFLAGS) -o $(BIN)/meme $(MEME_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT) $(LIBSOFTFLOAT)
tags: tags:
ctags -R -f .tags --exclude=root ctags -R -f .tags --exclude=root
@ -468,5 +474,6 @@ distclean: clean $(LIBUV_MAKEFILE)
$(MAKE) -C outside/ed25519 clean $(MAKE) -C outside/ed25519 clean
$(MAKE) -C outside/anachronism clean $(MAKE) -C outside/anachronism clean
$(MAKE) -C outside/scrypt clean $(MAKE) -C outside/scrypt clean
$(MAKE) -C outside/softfloat-3/build/Linux-386-GCC clean
.PHONY: clean debbuild debinstalldistclean etags osxpackage tags .PHONY: clean debbuild debinstalldistclean etags osxpackage tags

View File

@ -110,13 +110,15 @@
u3_noun u3qeo_raw(u3_atom, u3_atom); u3_noun u3qeo_raw(u3_atom, u3_atom);
u3_noun u3qer_sun(u3_atom);
u3_noun u3qer_mul(u3_atom, u3_atom);
u3_noun u3qer_div(u3_atom, u3_atom);
u3_noun u3qer_add(u3_atom, u3_atom); u3_noun u3qer_add(u3_atom, u3_atom);
u3_noun u3qer_sub(u3_atom, u3_atom); u3_noun u3qer_sub(u3_atom, u3_atom);
u3_noun u3qer_lte(u3_atom, u3_atom); u3_noun u3qer_mul(u3_atom, u3_atom);
u3_noun u3qer_div(u3_atom, u3_atom);
u3_noun u3qer_sqt(u3_atom);
u3_noun u3qer_fma(u3_atom, u3_atom, u3_atom);
u3_noun u3qer_lth(u3_atom, u3_atom); u3_noun u3qer_lth(u3_atom, u3_atom);
u3_noun u3qer_lte(u3_atom, u3_atom);
u3_noun u3qer_equ(u3_atom, u3_atom);
u3_noun u3qer_gte(u3_atom, u3_atom); u3_noun u3qer_gte(u3_atom, u3_atom);
u3_noun u3qer_gth(u3_atom, u3_atom); u3_noun u3qer_gth(u3_atom, u3_atom);

View File

@ -139,13 +139,15 @@
u3_noun u3we_stew_fun(u3_noun); u3_noun u3we_stew_fun(u3_noun);
u3_noun u3we_stir_fun(u3_noun); u3_noun u3we_stir_fun(u3_noun);
u3_noun u3wer_sun(u3_noun);
u3_noun u3wer_mul(u3_noun);
u3_noun u3wer_div(u3_noun);
u3_noun u3wer_add(u3_noun); u3_noun u3wer_add(u3_noun);
u3_noun u3wer_sub(u3_noun); u3_noun u3wer_sub(u3_noun);
u3_noun u3wer_lte(u3_noun); u3_noun u3wer_mul(u3_noun);
u3_noun u3wer_div(u3_noun);
u3_noun u3wer_sqt(u3_noun);
u3_noun u3wer_fma(u3_noun);
u3_noun u3wer_lth(u3_noun); u3_noun u3wer_lth(u3_noun);
u3_noun u3wer_lte(u3_noun);
u3_noun u3wer_equ(u3_noun);
u3_noun u3wer_gte(u3_noun); u3_noun u3wer_gte(u3_noun);
u3_noun u3wer_gth(u3_noun); u3_noun u3wer_gth(u3_noun);

View File

@ -2,97 +2,31 @@
** **
*/ */
#include "all.h" #include "all.h"
#include "softfloat.h"
#define DOUBNAN 0x7ff8000000000000
union doub { union doub {
double d; float64_t d;
c3_d c; c3_d c;
}; };
/* functions /* functions
*/ */
/* sun static inline c3_t
*/ _nan_test(float64_t a)
u3_noun
u3qer_sun(u3_atom a)
{ {
union doub b; return !f64_eq(a, a);
b.d = (double) u3r_chub(0, a);
return u3i_chubs(1, &b.c);
} }
u3_noun static inline float64_t
u3wer_sun(u3_noun cor) _nan_unify(float64_t a)
{ {
u3_noun a; if (_nan_test(a))
if (c3n == u3r_mean(cor, u3x_sam, &a, 0)
|| c3n == u3ud(a)) {
return u3m_bail(c3__exit);
}
else {
return u3qer_sun(a);
}
}
/* mul
*/
u3_noun
u3qer_mul(u3_atom a, u3_atom b)
{ {
union doub c, d, e; *(c3_d*)(&a) = DOUBNAN;
c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b);
e.d = c.d * d.d;
return u3i_chubs(1, &e.c);
}
u3_noun
u3wer_mul(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ||
c3n == u3ud(a) ||
c3n == u3ud(b) )
{
return u3m_bail(c3__exit);
}
else {
return u3qer_mul(a, b);
}
}
/* div
*/
u3_noun
u3qer_div(u3_atom a, u3_atom b)
{
union doub c, d, e;
c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b);
e.d = c.d / d.d;
return u3i_chubs(1, &e.c);
}
u3_noun
u3wer_div(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ||
c3n == u3ud(a) ||
c3n == u3ud(b) )
{
return u3m_bail(c3__exit);
}
else {
return u3qer_div(a, b);
} }
return a;
} }
/* add /* add
@ -103,7 +37,7 @@ union doub {
union doub c, d, e; union doub c, d, e;
c.c = u3r_chub(0, a); c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b); d.c = u3r_chub(0, b);
e.d = c.d + d.d; e.d = _nan_unify(f64_add(c.d, d.d));
return u3i_chubs(1, &e.c); return u3i_chubs(1, &e.c);
} }
@ -132,7 +66,7 @@ union doub {
union doub c, d, e; union doub c, d, e;
c.c = u3r_chub(0, a); c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b); d.c = u3r_chub(0, b);
e.d = c.d - d.d; e.d = _nan_unify(f64_sub(c.d, d.d));
return u3i_chubs(1, &e.c); return u3i_chubs(1, &e.c);
} }
@ -153,20 +87,21 @@ union doub {
} }
} }
/* lte /* mul
*/ */
u3_noun u3_noun
u3qer_lte(u3_atom a, u3_atom b) u3qer_mul(u3_atom a, u3_atom b)
{ {
union doub c, d; union doub c, d, e;
c.c = u3r_chub(0, a); c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b); d.c = u3r_chub(0, b);
e.d = _nan_unify(f64_mul(c.d, d.d));
return __(c.d <= d.d); return u3i_chubs(1, &e.c);
} }
u3_noun u3_noun
u3wer_lte(u3_noun cor) u3wer_mul(u3_noun cor)
{ {
u3_noun a, b; u3_noun a, b;
@ -177,7 +112,94 @@ union doub {
return u3m_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3qer_lte(a, b); return u3qer_mul(a, b);
}
}
/* div
*/
u3_noun
u3qer_div(u3_atom a, u3_atom b)
{
union doub c, d, e;
c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b);
e.d = _nan_unify(f64_div(c.d, d.d));
return u3i_chubs(1, &e.c);
}
u3_noun
u3wer_div(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ||
c3n == u3ud(a) ||
c3n == u3ud(b) )
{
return u3m_bail(c3__exit);
}
else {
return u3qer_div(a, b);
}
}
/* sqt
*/
u3_noun
u3qer_sqt(u3_atom a)
{
union doub c, d;
c.c = u3r_chub(0, a);
d.d = _nan_unify(f64_sqrt(c.d));
return u3i_chubs(1, &d.c);
}
u3_noun
u3wer_sqt(u3_noun cor)
{
u3_noun a;
if ( c3n == (a = u3r_at(u3x_sam, cor)) ||
c3n == u3ud(a) )
{
return u3m_bail(c3__exit);
}
else {
return u3qer_sqt(a);
}
}
/* fma
*/
u3_noun
u3qer_fma(u3_atom a, u3_atom b, u3_atom c)
{
union doub d, e, f, g;
d.c = u3r_chub(0, a);
e.c = u3r_chub(0, b);
f.c = u3r_chub(0, c);
g.d = _nan_unify(f64_mulAdd(d.d, e.d, f.d));
return u3i_chubs(1, &g.c);
}
u3_noun
u3wer_fma(u3_noun cor)
{
u3_noun a, b, c;
if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) ||
c3n == u3ud(a) ||
c3n == u3ud(b) ||
c3n == u3ud(c) )
{
return u3m_bail(c3__exit);
}
else {
return u3qer_fma(a, b, c);
} }
} }
@ -190,7 +212,7 @@ union doub {
c.c = u3r_chub(0, a); c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b); d.c = u3r_chub(0, b);
return __(c.d < d.d); return __(f64_lt(c.d, d.d));
} }
u3_noun u3_noun
@ -209,6 +231,62 @@ union doub {
} }
} }
/* lte
*/
u3_noun
u3qer_lte(u3_atom a, u3_atom b)
{
union doub c, d;
c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b);
return __(f64_le(c.d, d.d));
}
u3_noun
u3wer_lte(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ||
c3n == u3ud(a) ||
c3n == u3ud(b) )
{
return u3m_bail(c3__exit);
}
else {
return u3qer_lte(a, b);
}
}
/* equ
*/
u3_noun
u3qer_equ(u3_atom a, u3_atom b)
{
union doub c, d;
c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b);
return __(f64_eq(c.d, d.d));
}
u3_noun
u3wer_equ(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ||
c3n == u3ud(a) ||
c3n == u3ud(b) )
{
return u3m_bail(c3__exit);
}
else {
return u3qer_equ(a, b);
}
}
/* gte /* gte
*/ */
u3_noun u3_noun
@ -218,7 +296,7 @@ union doub {
c.c = u3r_chub(0, a); c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b); d.c = u3r_chub(0, b);
return __(c.d >= d.d); return __(f64_le(d.d, c.d));
} }
u3_noun u3_noun
@ -246,7 +324,7 @@ union doub {
c.c = u3r_chub(0, a); c.c = u3r_chub(0, a);
d.c = u3r_chub(0, b); d.c = u3r_chub(0, b);
return __(c.d > d.d); return __(f64_lt(d.d, c.d));
} }
u3_noun u3_noun

View File

@ -203,23 +203,27 @@ static u3j_core _mood__hoon__og_d[] =
{} {}
}; };
static u3j_harm _mood__hoon__rd_sun_a[] = {{".2", u3wer_sun}, {}};
static u3j_harm _mood__hoon__rd_mul_a[] = {{".2", u3wer_mul}, {}};
static u3j_harm _mood__hoon__rd_div_a[] = {{".2", u3wer_div}, {}};
static u3j_harm _mood__hoon__rd_add_a[] = {{".2", u3wer_add}, {}}; static u3j_harm _mood__hoon__rd_add_a[] = {{".2", u3wer_add}, {}};
static u3j_harm _mood__hoon__rd_sub_a[] = {{".2", u3wer_sub}, {}}; static u3j_harm _mood__hoon__rd_sub_a[] = {{".2", u3wer_sub}, {}};
static u3j_harm _mood__hoon__rd_lte_a[] = {{".2", u3wer_lte}, {}}; static u3j_harm _mood__hoon__rd_mul_a[] = {{".2", u3wer_mul}, {}};
static u3j_harm _mood__hoon__rd_div_a[] = {{".2", u3wer_div}, {}};
static u3j_harm _mood__hoon__rd_sqt_a[] = {{".2", u3wer_sqt}, {}};
static u3j_harm _mood__hoon__rd_fma_a[] = {{".2", u3wer_fma}, {}};
static u3j_harm _mood__hoon__rd_lth_a[] = {{".2", u3wer_lth}, {}}; static u3j_harm _mood__hoon__rd_lth_a[] = {{".2", u3wer_lth}, {}};
static u3j_harm _mood__hoon__rd_lte_a[] = {{".2", u3wer_lte}, {}};
static u3j_harm _mood__hoon__rd_equ_a[] = {{".2", u3wer_equ}, {}};
static u3j_harm _mood__hoon__rd_gte_a[] = {{".2", u3wer_gte}, {}}; static u3j_harm _mood__hoon__rd_gte_a[] = {{".2", u3wer_gte}, {}};
static u3j_harm _mood__hoon__rd_gth_a[] = {{".2", u3wer_gth}, {}}; static u3j_harm _mood__hoon__rd_gth_a[] = {{".2", u3wer_gth}, {}};
static u3j_core _mood__hoon__rd_d[] = static u3j_core _mood__hoon__rd_d[] =
{ { "sun", _mood__hoon__rd_sun_a }, { { "add", _mood__hoon__rd_add_a },
{ "sub", _mood__hoon__rd_sub_a },
{ "mul", _mood__hoon__rd_mul_a }, { "mul", _mood__hoon__rd_mul_a },
{ "div", _mood__hoon__rd_div_a }, { "div", _mood__hoon__rd_div_a },
{ "add", _mood__hoon__rd_add_a }, { "sqt", _mood__hoon__rd_sqt_a },
{ "sub", _mood__hoon__rd_sub_a }, { "fma", _mood__hoon__rd_fma_a },
{ "lte", _mood__hoon__rd_lte_a },
{ "lth", _mood__hoon__rd_lth_a }, { "lth", _mood__hoon__rd_lth_a },
{ "lte", _mood__hoon__rd_lte_a },
{ "equ", _mood__hoon__rd_equ_a },
{ "gte", _mood__hoon__rd_gte_a }, { "gte", _mood__hoon__rd_gte_a },
{ "gth", _mood__hoon__rd_gth_a }, { "gth", _mood__hoon__rd_gth_a },
{} {}