|
@@ -50,14 +50,14 @@ func fpSubRdc(z, x, y *Fp) { |
|
|
func fpRdcP(x *Fp) { |
|
|
func fpRdcP(x *Fp) { |
|
|
var borrow, mask uint64 |
|
|
var borrow, mask uint64 |
|
|
for i := 0; i < FP_WORDS; i++ { |
|
|
for i := 0; i < FP_WORDS; i++ { |
|
|
x[i], borrow = bits.Sub64(x[i], p503[i], borrow) |
|
|
|
|
|
|
|
|
x[i], borrow = bits.Sub64(x[i], p[i], borrow) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Sets all bits if borrow = 1 |
|
|
// Sets all bits if borrow = 1 |
|
|
mask = 0 - borrow |
|
|
mask = 0 - borrow |
|
|
borrow = 0 |
|
|
borrow = 0 |
|
|
for i := 0; i < FP_WORDS; i++ { |
|
|
for i := 0; i < FP_WORDS; i++ { |
|
|
x[i], borrow = bits.Add64(x[i], p503[i]&mask, borrow) |
|
|
|
|
|
|
|
|
x[i], borrow = bits.Add64(x[i], p[i]&mask, borrow) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -176,7 +176,7 @@ func fp2Sub(z, x, y *FpX2) { |
|
|
mask = 0 - borrow |
|
|
mask = 0 - borrow |
|
|
borrow = 0 |
|
|
borrow = 0 |
|
|
for i := FP_WORDS; i < 2*FP_WORDS; i++ { |
|
|
for i := FP_WORDS; i < 2*FP_WORDS; i++ { |
|
|
z[i], borrow = bits.Add64(z[i], p503[i-FP_WORDS]&mask, borrow) |
|
|
|
|
|
|
|
|
z[i], borrow = bits.Add64(z[i], p[i-FP_WORDS]&mask, borrow) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|