Question about mpz_set_str

Minh Nguyen md6nguyen@yahoo.com
Mon, 6 Jan 2003 07:10:29 -0800 (PST)


--0-1026398896-1041865829=:69346
Content-Type: text/plain; charset=us-ascii


Thanks, two more questions 
1/ When GMP reallocates a buffer, would the old buffer be freed? 
2/ Is it true that GMP only considers to enlarge a buffer, but never considers to shorten it?
Minh
 Kevin Ryde <user42@zip.com.au> wrote:Minh Nguyen writes:
>
> Why does GMP have to reallocate memory when it is not necessary?

Generally to keep size calculations simpler and smaller. There's no
sense making a complicated calculation just to shave one or two limbs
in certain cases.

It's left up to each mpz function to decide what it would like to
have, it just has to call MPZ_REALLOC and friends.


---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
--0-1026398896-1041865829=:69346
Content-Type: text/html; charset=us-ascii

<P>Thanks, two more questions 
<P>1/ When GMP reallocates a buffer, would the old buffer be freed? 
<P>2/ Is it true that GMP only considers to enlarge a buffer, but never considers to shorten it?
<P>Minh
<P>&nbsp;<B><I>Kevin Ryde &lt;user42@zip.com.au&gt;</I></B> wrote:
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Minh Nguyen <MD6NGUYEN@YAHOO.COM>writes:<BR>&gt;<BR>&gt; Why does GMP have to reallocate memory when it is not necessary?<BR><BR>Generally to keep size calculations simpler and smaller. There's no<BR>sense making a complicated calculation just to shave one or two limbs<BR>in certain cases.<BR><BR>It's left up to each mpz function to decide what it would like to<BR>have, it just has to call MPZ_REALLOC and friends.</BLOCKQUOTE><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com">Yahoo! Mail Plus</a> - Powerful. Affordable. <a href="http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com">Sign up now</a>
--0-1026398896-1041865829=:69346--