Skip to content

Commit

Permalink
fix bls12-377 test with MCL_USE_XBYAK=0
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Feb 21, 2025
1 parent 96aeff4 commit 93329b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions include/mcl/fp_tower.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,12 @@ class Fp2T : public fp::Serializable<Fp2T<_Fp>,
#ifdef MCL_XBYAK_DIRECT_CALL
Fp::op_.fp2_sqrA_(y.a.v_, x.a.v_);
#else
sqrA(y.a.v_, x.a.v_);
if (Fp::op_.u == 1) {
sqrA(y.a.v_, x.a.v_);
} else {
assert(Fp::op_.u == 5);
sqrAu5(y.a.v_, x.a.v_);
}
#endif
}
static void mul2(Fp2T& y, const Fp2T& x)
Expand Down Expand Up @@ -590,8 +595,7 @@ class Fp2T : public fp::Serializable<Fp2T<_Fp>,
const Fp2T& x = cast(px);
const Fp& a = x.a;
const Fp& b = x.b;
uint32_t u = Fp::getOp().u;
assert(u == 5);
assert(Fp::getOp().u == 5);
Fp t1, t2, t3;
Fp::mul2(t1, b); // 2b
Fp::mul2(t2, t1); // 4b
Expand Down Expand Up @@ -876,8 +880,7 @@ struct Fp2DblT {
{
Fp2Dbl& y = castD(py);
const Fp2& x = cast(px);
uint32_t u = Fp::getOp().u;
assert(u == 5);
assert(Fp::getOp().u == 5);
Fp t1, t2, t3;
Fp::mul2(t1, x.b); // 2b
FpDbl::mulPre(y.b, x.a, t1); // 2ab
Expand Down
2 changes: 2 additions & 0 deletions src/fp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
#endif

#include "xbyak/xbyak_util.h"
#ifdef MCL_USE_XBYAK
static const Xbyak::util::Cpu& getCpu()
{
static Xbyak::util::Cpu cpu;
return cpu;
}
#endif

#ifdef MCL_STATIC_CODE
#include "fp_static_code.hpp"
Expand Down

0 comments on commit 93329b2

Please sign in to comment.