diff --git a/pkg/urbit/include/jets/w.h b/pkg/urbit/include/jets/w.h index ab953abb0..8065457fd 100644 --- a/pkg/urbit/include/jets/w.h +++ b/pkg/urbit/include/jets/w.h @@ -69,8 +69,6 @@ u3_noun u3wc_rep(u3_noun); u3_noun u3wc_rev(u3_noun); u3_noun u3wc_rip(u3_noun); - u3_noun u3wc_repn(u3_noun); - u3_noun u3wc_ripn(u3_noun); u3_noun u3wc_rsh(u3_noun); u3_noun u3wc_swp(u3_noun); u3_noun u3wc_sqt(u3_noun); diff --git a/pkg/urbit/jets/c/repn.c b/pkg/urbit/jets/c/repn.c deleted file mode 100644 index 4b9c69435..000000000 --- a/pkg/urbit/jets/c/repn.c +++ /dev/null @@ -1,113 +0,0 @@ -#include "all.h" - -/* - Get the lowest `n` bits of a word `w` using a bitmask. -*/ -#define TAKEBITS(n,w) \ - ((n)==32) ? (w) : \ - ((n)==0) ? 0 : \ - ((w) & ((1 << (n)) - 1)) - -/* - Divide, rounding up. -*/ -#define DIVCEIL(x,y) \ - (x==0) ? 0 : \ - 1 + ((x - 1) / y); - -u3_noun -u3qc_repn(u3_atom bits, u3_noun blox) -{ - if ( (c3n == u3a_is_cat(bits) || bits==0 || bits>31) ) { - return u3m_bail(c3__fail); - } - - // - // Calculate input and output size. - // - c3_w num_blox_w = u3qb_lent(blox); - c3_w bit_widt_w = num_blox_w * bits; - c3_w wor_widt_w = DIVCEIL(bit_widt_w, 32); - u3i_slab sab_u; - u3i_slab_bare(&sab_u, 5, wor_widt_w); - - // - // Fill the atom buffer with bits from each block. - // - // Bits are pushed into the `acc_w` register and flushed to the buffer - // once full. - // - // acc_w register - // use_w number of register bits filled (used) - // cur_w next buffer word to flush into. - // - { - c3_w acc_w=0, use_w=0, *cur_w=sab_u.buf_w; - -# define FLUSH() *cur_w++=acc_w; acc_w=use_w=0 -# define SLICE(sz,off,val) TAKEBITS(sz, val) << off - - for (c3_w i=0; i> rem_in_acc_w; - FLUSH(); - } - } - } - - // - // If the last word isn't fully used, it will still need to be - // flushed. - // - if (use_w) { - FLUSH(); - } - } - - return u3i_slab_mint(&sab_u); -} - -u3_noun -u3wc_repn(u3_noun cor) -{ - u3_noun bits, blox; - - if ( (c3n == u3r_mean(cor, u3x_sam_2, &bits, u3x_sam_3, &blox, 0)) || - (c3n == u3ud(bits)) ) - { - return u3m_bail(c3__exit); - } - - return u3qc_repn(bits, blox); -} - -u3_noun -u3kc_repn(u3_atom bits, u3_atom blox) -{ - u3_noun res = u3qc_repn(bits, blox); - u3z(bits); u3z(blox); - return res; -} diff --git a/pkg/urbit/jets/c/ripn.c b/pkg/urbit/jets/c/ripn.c deleted file mode 100644 index e7a54a0f7..000000000 --- a/pkg/urbit/jets/c/ripn.c +++ /dev/null @@ -1,100 +0,0 @@ -#include "all.h" - -/* - Get the lowest `n` bits of a word `w` using a bitmask. -*/ -#define TAKEBITS(n,w) \ - ((n)==32) ? (w) : \ - ((n)==0) ? 0 : \ - ((w) & ((1 << (n)) - 1)) - -/* - Divide, rounding up. -*/ -#define DIVCEIL(x,y) \ - (x==0) ? 0 : \ - 1 + ((x - 1) / y); - -/* - `ripn` breaks `atom` into a list of blocks, of bit-width `bits`. The - resulting list will be least-significant block first. - - XX TODO This only handles cases where the bit-width is <= 32. - - For each block we produce, we need to grab the relevant words inside - `atom`, so we first compute their indicies. - - `ins_idx` is the word-index of the least-significant word we - care about, and `sig_idx` is the word after that. - - Next we grab those words (`ins_word` and `sig_word`) from the atom - using `u3r_word`. Note that `sig_idx` might be out-of-bounds for the - underlying array of `atom`, but `u3r_word` returns 0 in that case, - which is exatly what we want. - - Now, we need to grab the relevant bits out of both words, and combine - them. `bits_rem_in_ins_word` is the number of remaining (insignificant) - bits in `ins_word`, `nbits_ins` is the number of bits we want from the - less-significant word, and `nbits_sig` from the more-significant one. - - Take the least significant `nbits_sig` bits from `sig_word`, and take - the slice we care about from `ins_word`. In order to take that slice, - we drop `bits_rem_in_ins_word` insignificant bits, and then take the - `nbits_sig` most-significant bits. - - Last, we slice out those bits from the two words, combine them into - one word, and cons them onto the front of the result. -*/ -u3_noun u3qc_ripn(u3_atom bits, u3_atom atom) { - if ( !_(u3a_is_cat(bits) || bits==0 || bits>31) ) { - return u3m_bail(c3__fail); - } - - c3_w bit_width = u3r_met(0, atom); - c3_w num_blocks = DIVCEIL(bit_width, bits); - - u3_noun res = u3_nul; - - for ( c3_w blk = 0; blk < num_blocks; blk++ ) { - c3_w next_blk = blk + 1; - c3_w blks_rem = num_blocks - next_blk; - c3_w bits_rem = blks_rem * bits; - c3_w ins_idx = bits_rem / 32; - c3_w sig_idx = ins_idx + 1; - - c3_w bits_rem_in_ins_word = bits_rem % 32; - - c3_w ins_word = u3r_word(ins_idx, atom); - c3_w sig_word = u3r_word(sig_idx, atom); - c3_w nbits_ins = c3_min(bits, 32 - bits_rem_in_ins_word); - c3_w nbits_sig = bits - nbits_ins; - - c3_w ins_word_bits = TAKEBITS(nbits_ins, ins_word >> bits_rem_in_ins_word); - c3_w sig_word_bits = TAKEBITS(nbits_sig, sig_word); - - c3_w item = ins_word_bits | (sig_word_bits << nbits_ins); - - res = u3nc(item, res); - } - - return res; -} - -u3_noun u3wc_ripn(u3_noun cor) { - u3_noun bits, atom; - - if ( (c3n == u3r_mean(cor, u3x_sam_2, &bits, u3x_sam_3, &atom, 0)) || - (c3n == u3ud(bits)) || - (c3n == u3ud(atom)) ) - { - return u3m_bail(c3__exit); - } - - return u3qc_ripn(bits, atom); -} - -u3_noun u3kc_ripn(u3_atom bits, u3_atom atom) { - u3_noun res = u3qc_ripn(bits, atom); - u3z(bits), u3z(atom); - return res; -} diff --git a/pkg/urbit/jets/tree.c b/pkg/urbit/jets/tree.c index 057c4f7a1..c3d6d680a 100644 --- a/pkg/urbit/jets/tree.c +++ b/pkg/urbit/jets/tree.c @@ -2,7 +2,7 @@ To generate the hashes, take the sha256 of the jammed battery. For example: ``` - > `@ux`(shax (jam -:ripn)) + > `@ux`(shax (jam -:rip)) 0x2759.a693.1e9e.f9a5.2c8e.ee43.1088.43d9.4d39.32a6.b04f.86cb.6ba1.5553.4329.3a28 ``` @@ -1572,15 +1572,6 @@ static c3_c* _141_two_rip_ha[] = { "e8e0b834aded0d2738bcf38a93bf373d412a51e0cee7f274277a6393e634a65e", 0 }; -static u3j_harm _141_two_repn_a[] = {{".2", u3wc_repn, c3y}, {}}; -static c3_c* _141_two_repn_ha[] = { - 0 -}; -static u3j_harm _141_two_ripn_a[] = {{".2", u3wc_ripn, c3y}, {}}; -static c3_c* _141_two_ripn_ha[] = { - "2759a6931e9ef9a52c8eee43108843d94d3932a6b04f86cb6ba1555343293a28", - 0 -}; static u3j_harm _141_two_rsh_a[] = {{".2", u3wc_rsh, c3y}, {}}; static c3_c* _141_two_rsh_ha[] = { "a401145b4c11ec8d17a729fe30f06c295865ffed1b970b0a788f0fec1ed0a703", @@ -1868,8 +1859,6 @@ static u3j_core _141_two_d[] = { "rep", 7, _141_two_rep_a, 0, _141_two_rep_ha }, { "rev", 7, _141_two_rev_a, 0, _141_two_rev_ha }, { "rip", 7, _141_two_rip_a, 0, _141_two_rip_ha }, - { "repn", 7, _141_two_repn_a, 0, _141_two_repn_ha }, - { "ripn", 7, _141_two_ripn_a, 0, _141_two_ripn_ha }, { "rsh", 7, _141_two_rsh_a, 0, _141_two_rsh_ha }, { "swp", 7, _141_two_swp_a, 0, _141_two_swp_ha }, { "rub", 7, _141_two_rub_a, 0, _141_two_rub_ha },