on master help sign in
rip
969b669iko
nock/src/jets.rs+19
@@ -73,6 +73,7 @@ pub fn generate_jets() -> Jets {
73 (49642221456321333759873032692286222867, RAP),
73 (49642221456321333759873032692286222867, RAP),
74 (92956425869648916777812729456192604084, REP),
74 (92956425869648916777812729456192604084, REP),
75 (302196507237993702819920888576650809366, REV),
75 (302196507237993702819920888576650809366, REV),
76+ (111192034817574564051316537756194881830, RIP),
76 ])
77 ])
77}
78}
78
79
@@ -732,3 +733,21 @@ static REV: Jet = |ctx, n| {
732
733
733 Rc::new(Noun::Atom(target))
734 Rc::new(Noun::Atom(target))
734};
735};
736+
737+static RIP: Jet = |ctx, n| {
738+ let (bite, b) = n.as_cell().unwrap();
739+ let bite = bite.as_bite().unwrap();
740+ let mut b: Atom = b.as_atom().unwrap().clone();
741+
742+ let bits = bite.bits();
743+ let mask = (&ctx.big_uints.one << bits) - &ctx.big_uints.one;
744+
745+ let mut target = Vec::new();
746+
747+ while b > ctx.big_uints.zero {
748+ target.push(Rc::new(Noun::Atom(&mask & &b)));
749+ b = b >> bits;
750+ }
751+
752+ Noun::list_refs(target.iter().cloned())
753+};