finalExp checks zero

2merge^2
MITSUNARI Shigeo 4 years ago
parent 17b8da25e0
commit dd702ba232
  1. 4
      include/mcl/bn.hpp
  2. 6
      include/mcl/fp.hpp
  3. 2
      include/mcl/vint.hpp

@ -1616,6 +1616,10 @@ inline void makeAdjP(G1& adjP, const G1& P)
*/
inline void finalExp(Fp12& y, const Fp12& x)
{
if (x.isZero()) {
y.clear();
return;
}
#if 1
mapToCyclotomic(y, x);
#else

@ -531,7 +531,11 @@ public:
if (mulSmallUnit(z, x, y)) return;
op_.fp_mulUnit(z.v_, x.v_, y, op_.p);
}
static inline void inv(FpT& y, const FpT& x) { op_.fp_invOp(y.v_, x.v_, op_); }
static inline void inv(FpT& y, const FpT& x)
{
assert(!x.isZero());
op_.fp_invOp(y.v_, x.v_, op_);
}
static inline void divBy2(FpT& y, const FpT& x)
{
#if 0

@ -126,6 +126,7 @@ void divNM(T *q, size_t qn, T *r, const T *x, size_t xn, const T *y, size_t yn);
*/
inline uint32_t divUnit(uint32_t *pr, uint32_t H, uint32_t L, uint32_t y)
{
assert(y != 0);
uint64_t t = make64(H, L);
uint32_t q = uint32_t(t / y);
*pr = uint32_t(t % y);
@ -134,6 +135,7 @@ inline uint32_t divUnit(uint32_t *pr, uint32_t H, uint32_t L, uint32_t y)
#if MCL_SIZEOF_UNIT == 8
inline uint64_t divUnit(uint64_t *pr, uint64_t H, uint64_t L, uint64_t y)
{
assert(y != 0);
#if defined(MCL_VINT_64BIT_PORTABLE) || (defined(_MSC_VER) && _MSC_VER < 1920)
uint32_t px[4] = { uint32_t(L), uint32_t(L >> 32), uint32_t(H), uint32_t(H >> 32) };
uint32_t py[2] = { uint32_t(y), uint32_t(y >> 32) };

Loading…
Cancel
Save