Skip to main content

impl_packed_field_div

Macro impl_packed_field_div 

Source
macro_rules! impl_packed_field_div {
    ($type:ty $(, ($type_param:ty, $param_name:ty))?) => { ... };
}
Expand description

Given a packed field type, implement Div<Self> and DivAssign<Self> using Montgomery’s trick on a stack-allocated buffer.

This requires the type to implement PackedValue (for from_fn and as_slice) and Mul<Self> (for the multiplication step). Only a single field inversion is performed regardless of the packing width, and no heap allocation is needed.