mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
u3: refactors gmp initialization in u3r_mp()
This commit is contained in:
parent
0681c9a477
commit
45ef57ab1a
@ -1205,16 +1205,11 @@ u3r_mp(mpz_t a_mp,
|
||||
else {
|
||||
u3a_atom* b_u = u3a_to_ptr(b);
|
||||
c3_w len_w = b_u->len_w;
|
||||
c3_d bit_d = (c3_d)len_w << 5;
|
||||
|
||||
// avoid reallocation on import, if possible
|
||||
//
|
||||
if ( (len_w >> 27) ) {
|
||||
mpz_init(a_mp);
|
||||
}
|
||||
else {
|
||||
mpz_init2(a_mp, len_w << 5);
|
||||
}
|
||||
|
||||
mpz_init2(a_mp, (c3_w)c3_min(bit_d, UINT32_MAX));
|
||||
mpz_import(a_mp, len_w, -1, sizeof(c3_w), 0, 0, b_u->buf_w);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user