rename setArrayAsLE to convertArrayAsLE

2merge^2
MITSUNARI Shigeo 4 years ago
parent 71ae0bb970
commit 9c3782c3b9
  1. 2
      include/mcl/conversion.hpp
  2. 4
      include/mcl/gmp_util.hpp
  3. 2
      include/mcl/vint.hpp

@ -22,7 +22,7 @@ namespace mcl { namespace fp {
return false if sizeof(D) * dstN < sizeof(S) * srcN
*/
template<class D, class S>
bool setArrayAsLE(D *dst, size_t dstN, const S *src, size_t srcN)
bool convertArrayAsLE(D *dst, size_t dstN, const S *src, size_t srcN)
{
char assert_D_is_unsigned[D(-1) < 0 ? -1 : 1];
char assert_S_is_unsigned[S(-1) < 0 ? -1 : 1];

@ -67,14 +67,14 @@ template<class T>
void getArray(bool *pb, T *buf, size_t maxSize, const mpz_class& x)
{
#ifdef MCL_USE_VINT
*pb = fp::setArrayAsLE(buf, maxSize, x.getUnit(), x.getUnitSize());
*pb = fp::convertArrayAsLE(buf, maxSize, x.getUnit(), x.getUnitSize());
#else
int n = x.get_mpz_t()->_mp_size;
if (n < 0) {
*pb = false;
return;
}
*pb = fp::setArrayAsLE(buf, maxSize, x.get_mpz_t()->_mp_d, n);
*pb = fp::convertArrayAsLE(buf, maxSize, x.get_mpz_t()->_mp_d, n);
#endif
}
inline void set(mpz_class& z, uint64_t x)

@ -1179,7 +1179,7 @@ public:
size_t unitSize = (sizeof(S) * size + sizeof(Unit) - 1) / sizeof(Unit);
buf_.alloc(pb, unitSize);
if (!*pb) return;
bool b = fp::setArrayAsLE(&buf_[0], unitSize, x, size);
bool b = fp::convertArrayAsLE(&buf_[0], unitSize, x, size);
assert(b);
(void)b;
trim(unitSize);

Loading…
Cancel
Save