diff --git a/src/wnaf.rs b/src/wnaf.rs index 6de3d71..15a7a15 100644 --- a/src/wnaf.rs +++ b/src/wnaf.rs @@ -540,6 +540,18 @@ impl WnafBase { wnaf_multi_exp(tables.as_slice(), wnafs.as_slice()) } + + /// Perform a multiscalar multiplication over a fixed-size array of bases and scalars, + /// avoiding heap allocation for the slice-of-slices. + pub fn multiscalar_mul_array( + scalars: &[WnafScalar; N], + bases: &[Self; N], + ) -> G { + let wnafs = scalars.each_ref().map(|s| s.wnaf.as_slice()); + let tables = bases.each_ref().map(|b| b.table.as_slice()); + + wnaf_multi_exp(&tables, &wnafs) + } } impl Mul<&WnafScalar>