use miden_core::Felt;
use miden_precompiles::{CurveId, Limbs, UintDomain};
use crate::{ec::EcGroupMsg, uint::UintValMsg};
pub(crate) fn fixed_uints() -> impl Iterator<Item = (u32, u32, Limbs)> {
UintDomain::ALL
.into_iter()
.map(|domain| {
let ptr = domain.bound_ptr();
(ptr, ptr, domain.minus_one())
})
.chain(CurveId::ALL.into_iter().flat_map(|curve| {
let bound_ptr = curve.base_domain().bound_ptr();
[
(curve.a_ptr(), bound_ptr, curve.a_value()),
(curve.b_ptr(), bound_ptr, curve.b_value()),
]
}))
}
pub(crate) fn fixed_uintval_msgs() -> impl Iterator<Item = UintValMsg<Felt>> {
fixed_uints().map(|(ptr, bound_ptr, limbs)| UintValMsg {
ptr: Felt::from(ptr),
bound_ptr: Felt::from(bound_ptr),
limbs: core::array::from_fn(|i| Felt::from(limbs[i])),
})
}
pub(crate) fn fixed_ecgroup_msgs() -> impl Iterator<Item = EcGroupMsg<Felt>> {
CurveId::ALL.into_iter().map(|curve| EcGroupMsg {
group_ptr: Felt::from(curve.group_ptr()),
a_ptr: Felt::from(curve.a_ptr()),
b_ptr: Felt::from(curve.b_ptr()),
bound_ptr: Felt::from(curve.base_domain().bound_ptr()),
scalar_bound_ptr: Felt::from(curve.scalar_domain().bound_ptr()),
})
}