Skip to content

Commit 2939d45

Browse files
committed
tovec
1 parent 7f5f6f1 commit 2939d45

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/integer_common.h

+8-6
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,18 @@ struct integer {
192192
//lsb first
193193
vector<uint64> to_vector() const {
194194
vector<uint64> res;
195-
res.resize(mpz_sizeinbase(impl, 2)/64 + 1, 0);
196195

197-
size_t count;
198-
mpz_export(res.data(), &count, -1, 8, 0, 0, impl);
199-
if (count == 0) {
196+
if (mpz_size(impl)==0) {
200197
res.resize(1);
201198
res[0]=0;
199+
return res;
202200
}
203-
else
204-
res.resize(count);
201+
202+
res.resize(mpz_sizeinbase(impl, 2)/64 + 1, 0);
203+
204+
size_t count;
205+
mpz_export(res.data(), &count, -1, 8, 0, 0, impl);
206+
res.resize(count);
205207

206208
return res;
207209
}

0 commit comments

Comments
 (0)