Merge pull request #2 from arybczak/add-set

add set to Fp6T and Fp2T
dev
MITSUNARI Shigeo 8 years ago committed by GitHub
commit 46393928fd
  1. 11
      include/mcl/fp_tower.hpp

@ -119,6 +119,11 @@ public:
a.clear(); a.clear();
b.clear(); b.clear();
} }
void set(const Fp &a_, const Fp &b_)
{
a = a_;
b = b_;
}
static void add(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::op_.fp2_add(z.a.v_, x.a.v_, y.a.v_); } static void add(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::op_.fp2_add(z.a.v_, x.a.v_, y.a.v_); }
static void sub(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::op_.fp2_sub(z.a.v_, x.a.v_, y.a.v_); } static void sub(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::op_.fp2_sub(z.a.v_, x.a.v_, y.a.v_); }
static void addPre(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::addPre(z.a, x.a, y.a); Fp::addPre(z.b, x.b, y.b); } static void addPre(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::addPre(z.a, x.a, y.a); Fp::addPre(z.b, x.b, y.b); }
@ -575,6 +580,12 @@ struct Fp6T : public fp::Operator<Fp6T<Fp> > {
const Fp* getFp0() const { return a.getFp0(); } const Fp* getFp0() const { return a.getFp0(); }
Fp2* getFp2() { return &a; } Fp2* getFp2() { return &a; }
const Fp2* getFp2() const { return &a; } const Fp2* getFp2() const { return &a; }
void set(const Fp2 &a_, const Fp2 &b_, const Fp2 &c_)
{
a = a_;
b = b_;
c = c_;
}
bool isZero() const bool isZero() const
{ {
return a.isZero() && b.isZero() && c.isZero(); return a.isZero() && b.isZero() && c.isZero();

Loading…
Cancel
Save