summaryrefslogtreecommitdiff
path: root/gmp.texi
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2001-11-26 23:56:39 +0100
committerKevin Ryde <user42@zip.com.au>2001-11-26 23:56:39 +0100
commit402636d74043193b19567c3dcb8002777b2020e7 (patch)
tree552a217a1a0a1faa0a51a75f8021b8aa748525f6 /gmp.texi
parent7cee3a1d860b68f897577b7ba70f75f7e012380a (diff)
downloadgmp-402636d74043193b19567c3dcb8002777b2020e7.tar.gz
More of:
* mpz/init2.c, mpz/realloc2.c: New files. * gmp.texi (Initializing Integers): Add documentation, reword other parts.
Diffstat (limited to 'gmp.texi')
-rw-r--r--gmp.texi16
1 files changed, 8 insertions, 8 deletions
diff --git a/gmp.texi b/gmp.texi
index 08a49a570..d1f29f5bb 100644
--- a/gmp.texi
+++ b/gmp.texi
@@ -2285,9 +2285,8 @@ Free the space occupied by @var{integer}. Call this function for all
@end deftypefun
@deftypefun void mpz_realloc2 (mpz_t @var{integer}, unsigned long @var{n})
-Change the space allocated for @var{integer} to @var{n} bits. If the current
-value in @var{integer} requires more than @var{n} bits then the space is just
-changed down to that required size.
+Change the space allocated for @var{integer} to @var{n} bits. The value in
+@var{integer} is preserved if it fits, or is set to 0 if not.
This function can be used to increase the space for a variable in order to
avoid repeated automatic reallocations, or to decrease it to give memory back
@@ -2335,12 +2334,13 @@ function. Don't call @code{mpz_clear}!
@end deftypefun
@deftypefun {void *} _mpz_realloc (mpz_t @var{integer}, mp_size_t @var{new_alloc})
-Change the space for @var{integer} to @var{new_alloc} limbs. The return value
-is not useful to applications and should be ignored. @code{mpz_realloc2} is
-the preferred way to accomplish size changes like this.
+Change the space for @var{integer} to @var{new_alloc} limbs. The value in
+@var{integer} is preserved if it fits, or is set to 0 if not. The return
+value is not useful to applications and should be ignored.
-If the requested new space is not sufficient for the current variable value,
-the value is cleared to 0.
+@code{mpz_realloc2} is the preferred way to accomplish allocation changes like
+this. @code{mpz_realloc2} and @code{_mpz_realloc} are the same except that
+@code{_mpz_realloc} takes the new size in limbs.
@end deftypefun