mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-13 14:39:25 +00:00
Make NUM_BITS an argument for the field macro
This commit is contained in:
@@ -74,6 +74,7 @@ macro_rules! field {
|
||||
$MODULUS: ident,
|
||||
$WIDE_MODULUS: ident,
|
||||
|
||||
$NUM_BITS: literal,
|
||||
$MULTIPLICATIVE_GENERATOR: literal,
|
||||
$S: literal,
|
||||
$ROOT_OF_UNITY: literal,
|
||||
@@ -212,8 +213,8 @@ macro_rules! field {
|
||||
|
||||
const MODULUS: &'static str = $MODULUS_STR;
|
||||
|
||||
const NUM_BITS: u32 = 256;
|
||||
const CAPACITY: u32 = 255;
|
||||
const NUM_BITS: u32 = $NUM_BITS;
|
||||
const CAPACITY: u32 = $NUM_BITS - 1;
|
||||
|
||||
const TWO_INV: Self = $FieldName($ResidueType::new(&U256::from_u8(2)).invert().0);
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ impl Group for Point {
|
||||
let RR = R * R;
|
||||
let B = X1 + R;
|
||||
let B = (B * B) - XX - RR;
|
||||
let h = (w * w) - B.double();
|
||||
let h = (w * w) - B.double();
|
||||
let X3 = h * s;
|
||||
let Y3 = w * (B - h) - RR.double();
|
||||
let Z3 = sss;
|
||||
|
||||
@@ -32,6 +32,7 @@ field!(
|
||||
MODULUS_STR,
|
||||
MODULUS,
|
||||
WIDE_MODULUS,
|
||||
256,
|
||||
3,
|
||||
1,
|
||||
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e",
|
||||
|
||||
Reference in New Issue
Block a user