dev
MITSUNARI Shigeo 10 years ago
parent 8a1a9656a2
commit 151d9bd5a1
  1. 2
      include/mcl/conversion.hpp
  2. 7
      include/mcl/fp.hpp
  3. 1
      include/mcl/op.hpp
  4. 2
      include/mcl/util.hpp

@ -5,7 +5,7 @@
#include <mcl/util.hpp>
/**
@file
@brief utility of Fp
@brief convertion from T[] to str2, str16
@author MITSUNARI Shigeo(@herumi)
@license modified new BSD license
http://opensource.org/licenses/BSD-3-Clause

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

@ -6,7 +6,6 @@
@license modified new BSD license
http://opensource.org/licenses/BSD-3-Clause
*/
#include <assert.h>
#include <mcl/gmp_util.hpp>
#ifndef MCL_MAX_OP_BIT_N

@ -1,7 +1,7 @@
#pragma once
/**
@file
@brief definition of Unit and some functions
@brief functions for T[]
@author MITSUNARI Shigeo(@herumi)
@license modified new BSD license
http://opensource.org/licenses/BSD-3-Clause

Loading…
Cancel
Save