GLV2 supports GT::pow

update-fork
MITSUNARI Shigeo 5 years ago
parent de44c1336d
commit cc1396f753
  1. 10
      include/mcl/bn.hpp
  2. 10
      include/mcl/fp_tower.hpp

@ -859,7 +859,7 @@ struct GLV2 {
template<class T>
void mul(T& Q, const T& P, mpz_class x, bool constTime = false) const
{
#if 0
#if 1
const int w = 5;
const size_t tblSize = 1 << (w - 2);
const size_t splitN = 4;
@ -877,14 +877,14 @@ struct GLV2 {
x += r;
}
split(u, x);
for (size_t i = 0; i < splitN; i++) {
gmp::getNAFwidth(&b, naf[i], u[i], w);
assert(b); (void)b;
}
tbl[0][0] = P;
Frobenius(tbl[1][0], tbl[0][0]);
Frobenius(tbl[2][0], tbl[1][0]);
Frobenius(tbl[3][0], tbl[2][0]);
for (size_t i = 0; i < splitN; i++) {
gmp::getNAFwidth(&b, naf[i], u[i], w);
assert(b); (void)b;
}
{
T P2;
T::dbl(P2, P);

@ -1336,6 +1336,12 @@ struct GroupMtoA : public T {
{
T::mul(castT(z), castT(x), castT(y));
}
static void sub(GroupMtoA& z, const GroupMtoA& x, const GroupMtoA& y)
{
T r;
T::unitaryInv(r, castT(y));
T::mul(castT(z), castT(x), r);
}
static void dbl(GroupMtoA& y, const GroupMtoA& x)
{
T::sqr(castT(y), castT(x));
@ -1363,6 +1369,10 @@ struct GroupMtoA : public T {
{
add(*this, *this, rhs);
}
void operator-=(const GroupMtoA& rhs)
{
sub(*this, *this, rhs);
}
void normalize() {}
private:
bool isOne() const;

Loading…
Cancel
Save