Skip to main content

eval_bytecode

Function eval_bytecode 

Source
pub fn eval_bytecode(
    prog: &CompiledProgram,
    bands: &[&[f64]],
    pixel_idx: usize,
    cache: &mut [f64],
    stack: &mut Vec<f64>,
) -> Result<f64>
Expand description

Execute the bytecode program for a single pixel.

§Arguments

  • prog – The compiled program (constant, shared across all pixels).
  • bands – A slice of band data slices, 0-indexed (bands[0] = B1).
  • pixel_idx – Linear index into each band slice for the current pixel.
  • cache – Pre-allocated Vec<f64> with prog.cache_slot_count entries. Values are populated by StoreCacheSlot during the prelude.
  • stack – Pre-allocated scratch Vec<f64>; cleared at the start of each call. Capacity should be >= prog.estimated_stack_depth.

§Errors

Returns AlgorithmError on stack underflow or band out-of-range. Division by zero and invalid power operations return f64::NAN (not an error).