miden-processor 0.19.1

Miden VM processor
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use super::{ExecutionError, Felt};
use crate::{ErrorContext, ONE, ZERO};

/// Asserts that the given value is a binary value (0 or 1).
#[inline(always)]
pub fn assert_binary(value: Felt, err_ctx: &impl ErrorContext) -> Result<Felt, ExecutionError> {
    if value != ZERO && value != ONE {
        Err(ExecutionError::not_binary_value_op(value, err_ctx))
    } else {
        Ok(value)
    }
}