Commit d33e5b41 authored by Niels Möller's avatar Niels Möller

(nettle_mpz_set_sexp): Use

nettle_mpz_set_str_256_s, to handle negative numbers correctly.

Rev: src/nettle/sexp2bignum.c:1.2
parent 899af3c0
......@@ -35,12 +35,13 @@ int
nettle_mpz_set_sexp(mpz_t x, unsigned limit, const struct sexp_iterator *i)
{
if (i->type == SEXP_ATOM
&& i->atom_length
&& !i->display)
{
if (limit && (8 * i->atom_length > limit))
return 0;
nettle_mpz_set_str_256(x, i->atom_length, i->atom);
nettle_mpz_set_str_256_s(x, i->atom_length, i->atom);
return !limit || mpz_sizeinbase(x, 2) <= limit;
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment