|
|
@ -20,6 +20,7 @@ |
|
|
|
// #define USE_MONT_FP
|
|
|
|
// #define USE_MONT_FP
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#include <cybozu/hash.hpp> |
|
|
|
#include <cybozu/hash.hpp> |
|
|
|
|
|
|
|
#include <cybozu/bit_operation.hpp> |
|
|
|
#include <mcl/op.hpp> |
|
|
|
#include <mcl/op.hpp> |
|
|
|
#include <mcl/util.hpp> |
|
|
|
#include <mcl/util.hpp> |
|
|
|
#include <mcl/power.hpp> |
|
|
|
#include <mcl/power.hpp> |
|
|
@ -240,11 +241,15 @@ public: |
|
|
|
FpT t(x); |
|
|
|
FpT t(x); |
|
|
|
for (size_t i = 0; i < yn; i++) { |
|
|
|
for (size_t i = 0; i < yn; i++) { |
|
|
|
const Unit v = y[i]; |
|
|
|
const Unit v = y[i]; |
|
|
|
int m = (int)sizeof(Unit) * 8; |
|
|
|
int m = (int)fp::UnitBitN; |
|
|
|
if (i == yn - 1) { |
|
|
|
if (i == yn - 1) { |
|
|
|
|
|
|
|
#if 1 |
|
|
|
|
|
|
|
m = v ? cybozu::bsr<Unit>(v) + 1 : 0; |
|
|
|
|
|
|
|
#else |
|
|
|
while (m > 0 && (v & (Unit(1) << (m - 1))) == 0) { |
|
|
|
while (m > 0 && (v & (Unit(1) << (m - 1))) == 0) { |
|
|
|
m--; |
|
|
|
m--; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
for (int j = 0; j < m; j++) { |
|
|
|
for (int j = 0; j < m; j++) { |
|
|
|
if (v & (Unit(1) << j)) { |
|
|
|
if (v & (Unit(1) << j)) { |
|
|
|