fit_decode_ring_slots

Function fit_decode_ring_slots 

Source
pub fn fit_decode_ring_slots(
    start_slots: usize,
    reserve_without_ring: usize,
    bytes_per_ring_slot: usize,
    free_mem: usize,
) -> usize
Expand description

2026-09-25: Largest DECODE_RING_FIT_LADDER depth, at most start_slots, with reserve_without_ring + depth * bytes_per_ring_slot <= free_mem (saturating arithmetic). bytes_per_ring_slot is one depth unit of the ring. Returns 0 also when no depth fits; the caller tells the two apart by comparing the total against its limit (preflight/decode_ring.rs).