mirror of
https://github.com/urbit/ares.git
synced 2024-11-23 17:24:52 +03:00
Merge pull request #70 from urbit/eamsden/fix-cut
jets: fix cut for 0 run
This commit is contained in:
commit
08f14b8318
@ -543,6 +543,10 @@ pub fn jet_cut(stack: &mut NockStack, subject: Noun) -> Result<Noun, JetErr> {
|
||||
let run = raw_slot(arg, 13).as_direct()?.data() as usize;
|
||||
let atom = raw_slot(arg, 7).as_atom()?;
|
||||
|
||||
if run == 0 {
|
||||
return Ok(D(0));
|
||||
}
|
||||
|
||||
let new_indirect = unsafe {
|
||||
let (mut new_indirect, new_slice) =
|
||||
IndirectAtom::new_raw_mut_bitslice(stack, ((run << bloq) + 63) >> 6);
|
||||
@ -1225,6 +1229,9 @@ mod tests {
|
||||
fn test_cut() {
|
||||
let s = &mut init();
|
||||
let (_a0, a24, _a63, a96, a128) = atoms(s);
|
||||
let run = T(s, &[D(0), D(0)]);
|
||||
let sam = T(s, &[D(0), run, a24]);
|
||||
assert_jet(s, jet_cut, sam, D(0));
|
||||
let run = T(s, &[D(0), D(5)]);
|
||||
let sam = T(s, &[D(0), run, a24]);
|
||||
assert_jet(s, jet_cut, sam, D(0x3));
|
||||
|
Loading…
Reference in New Issue
Block a user