1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
use super::state::EntryStack; pub(super) fn apply_pick(state: &mut EntryStack) -> Option<()> { let depth = state.top_literal()?; let needed = depth.saturating_add(1); state.pop_count(1); state.ensure_available(needed); let picked = state.value_from_top(depth); state.push(picked); Some(()) } pub(super) fn apply_roll(state: &mut EntryStack) -> Option<()> { let depth = state.top_literal()?; let needed = depth.saturating_add(1); state.pop_count(1); state.ensure_available(needed); if let Some(value) = state.remove_from_top(depth) { state.push(value); } else { state.mark_top_unknown(); } Some(()) } pub(super) fn apply_xdrop(state: &mut EntryStack) -> Option<()> { let depth = state.top_literal()?; let needed = depth.saturating_add(1); state.pop_count(1); state.ensure_available(needed); state.remove_from_top(depth); Some(()) } pub(super) fn apply_reversen(state: &mut EntryStack) -> Option<()> { let count = state.top_literal()?; state.pop_count(1); state.ensure_available(count); state.reverse_top(count); Some(()) }