Skip to content

Const generic equivalent of Curve::batch_normalize #50

@tarcieri

Description

@tarcieri

batch_normalize currently documents this caveat:

This function will panic if p.len() != q.len().

However, with const generics you can construct an output array that matches the input size with compile-time assurances:

fn batch_normalize_array<const N: usize>(points: &[Self, N]) -> [Self::AffineRepr; N] { ... }

This issue is to suggest an addition, rather than a replacement, specifically for use cases where the number of points is fixed at compile-time.

Note that this approach is also useful for stack allocating all intermediate values (since you can size the arrays by N), allowing for efficient implementations on heapless targets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions