Macro finite_fields::unit_nary_arithmetic
[−]
[src]
macro_rules! unit_nary_arithmetic { ($tyname:ident, $arity:expr, $storsize:ident) => { ... }; }
Implements arithmetic on a unit n-ary newtype with overflow and division by zero errors.
There are three arguments: $tyname, $arity and $storsize. $tyname is
just the name of the resulting type. $arity defines the arity of the type
(e.g. 2 for binary), while $storsize defines the storage type used to
store the digit, since that is the underlying vocabulary Rust allows us to
work with. So it must be a valid numeric type large enough to store the
arity, and one that implements basic arithmetic (e.g., u8, u16).