|
1 | | -/// Provides both inherent and trait impls for a field element type which are |
2 | | -/// backed by a core set of arithmetic functions specified as macro arguments. |
| 1 | +/// Implements a field element type whose internal representation is in |
| 2 | +/// Montgomery form, providing a combination of trait impls and inherent impls |
| 3 | +/// which are `const fn` where possible. |
| 4 | +/// |
| 5 | +/// Accepts a set of `const fn` arithmetic operation functions as arguments. |
3 | 6 | /// |
4 | 7 | /// # Inherent impls |
5 | 8 | /// - `const ZERO: Self` |
|
42 | 45 | /// - `MulAssign` |
43 | 46 | /// - `Neg` |
44 | 47 | #[macro_export] |
45 | | -macro_rules! impl_field_element { |
| 48 | +macro_rules! impl_mont_field_element { |
46 | 49 | ( |
47 | 50 | $curve:tt, |
48 | 51 | $fe:tt, |
@@ -364,9 +367,9 @@ macro_rules! impl_field_element { |
364 | 367 | } |
365 | 368 | } |
366 | 369 |
|
367 | | - $crate::impl_field_op!($fe, $uint, Add, add, $add); |
368 | | - $crate::impl_field_op!($fe, $uint, Sub, sub, $sub); |
369 | | - $crate::impl_field_op!($fe, $uint, Mul, mul, $mul); |
| 370 | + $crate::impl_field_op!($fe, Add, add, $add); |
| 371 | + $crate::impl_field_op!($fe, Sub, sub, $sub); |
| 372 | + $crate::impl_field_op!($fe, Mul, mul, $mul); |
370 | 373 |
|
371 | 374 | impl AddAssign<$fe> for $fe { |
372 | 375 | #[inline] |
@@ -449,7 +452,7 @@ macro_rules! impl_field_element { |
449 | 452 | /// which thunk to the given function. |
450 | 453 | #[macro_export] |
451 | 454 | macro_rules! impl_field_op { |
452 | | - ($fe:tt, $uint:ty, $op:tt, $op_fn:ident, $func:ident) => { |
| 455 | + ($fe:tt, $op:tt, $op_fn:ident, $func:ident) => { |
453 | 456 | impl ::core::ops::$op for $fe { |
454 | 457 | type Output = $fe; |
455 | 458 |
|
|
0 commit comments